Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server
You last visited: Today at 10:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[WARNING]Char rez script

Discussion on [WARNING]Char rez script within the Shaiya Private Server forum part of the Shaiya category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: May 2012
Posts: 95
Received Thanks: 56
[WARNING]Char rez script

Guys today I found a huge problem... Thankfully I back up quite regularly.

The Char_res.php I got from here and have been using for months suddenly decided to delete both My Users_Master and Chars table.

Jus a warning to all who use and a query on whether it is able to be fixed or should i just bin it?
[Boss]FemmeFatale is offline  
Old 08/25/2012, 17:25   #2
 
elite*gold: 0
Join Date: Feb 2012
Posts: 267
Received Thanks: 50
Its not the res script, that are hackers, on all known servers that are postet on epepvers.
cypherxxl is offline  
Old 08/25/2012, 17:56   #3
 
elite*gold: 0
Join Date: May 2012
Posts: 95
Received Thanks: 56
Thank you for reply but it was definitely the rez script
[Boss]FemmeFatale is offline  
Old 08/25/2012, 20:44   #4
 
STIV123's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 216
Received Thanks: 127
Same happened here, and it was when i put char rez script.. just a day or 2 after that.. ^^ So yeah it's that for sure. SQL Injectible i quess.
STIV123 is offline  
Old 08/26/2012, 00:13   #5
 
elite*gold: 0
Join Date: May 2012
Posts: 95
Received Thanks: 56
I guess so Jus thought I would post a warning to others using it been one hell of a day fixing the situation.

Hope noone else has the day I just had
[Boss]FemmeFatale is offline  
Old 08/26/2012, 00:37   #6
 
elite*gold: 0
Join Date: Oct 2010
Posts: 74
Received Thanks: 77
If you know anything about php you may want to look at the MSSQL escape string or lack of it in the script. You should always proof read the scripts that you put up. Its unfortunate but sometimes people miss things or just dont think its nessassary. Best of luck to you on your server and this has been happening on a few servers. Make sure you actually fix the script before putting it back up or they will just do it again.
KarmaIsMe is offline  
Old 08/26/2012, 00:57   #7
 
Bаne's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 2,334
Received Thanks: 1,777
Quote:
Originally Posted by [Boss]FemmeFatale View Post
Guys today I found a huge problem... Thankfully I back up quite regularly.

The Char_res.php I got from here and have been using for months suddenly decided to delete both My Users_Master and Chars table.

Jus a warning to all who use and a query on whether it is able to be fixed or should i just bin it?
That's impossible, the script does what is writen in the code, if there was a portion of it that deleted tables I think people would have noticed/removed it.
Bаne is offline  
Old 08/26/2012, 03:08   #8
 
JohnHeatz's Avatar
 
elite*gold: 150
Join Date: Apr 2010
Posts: 9,739
Received Thanks: 8,981
Which script exactly are you working with exactly? I never heard of any resurrection script doing that, nor one not being secure for SQL injection
JohnHeatz is offline  
Old 08/26/2012, 15:51   #9
 
treica's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 525
Received Thanks: 805
Why don't you guys use an php sql protection google for "sql injection php protection" and attacker will be unable to use the command "drop" "create" etc..if you use it as index.php on all ur web folders..yes admin panel and char ress script has an injection "because is comunicating directly with the database".
I know stars was a target yesterday of these tables scheduled for deletion which mean or you keep offline the server till your "users" change their password or clean and start from begin since the hacker has the tables and can do what ever he wants on the attacked server with users accounts.

Kind Regards,
treica.
treica is offline  
Thanks
1 User
Old 08/26/2012, 17:32   #10
 
STIV123's Avatar
 
elite*gold: 0
Join Date: Apr 2011
Posts: 216
Received Thanks: 127
@John,


It was released here in EPvP, here's the link:

STIV123 is offline  
Old 08/26/2012, 18:35   #11
 
JohnHeatz's Avatar
 
elite*gold: 150
Join Date: Apr 2010
Posts: 9,739
Received Thanks: 8,981
Asking her directly due to the possibility of being using a different one, or even a customized one
JohnHeatz is offline  
Old 08/26/2012, 22:14   #12
 
elite*gold: 0
Join Date: Oct 2010
Posts: 74
Received Thanks: 77
Again, the one released on epvp is incomplete and has a security flaw. Fix the script D:<

Just because it is a release doesn't mean its perfect. We are all human and we all make mistakes or simple errors.

If you are using ODBC;

Code:
<?php
  function mssql_escape_string($data)
  {
      if (!isset($data) or empty($data))
          return '';
      if (is_numeric($data))
          return $data;
      $non_displayables = array('/%0[0-8bcef]/', // url encoded 00-08, 11, 12, 14, 15
      '/%1[0-9a-f]/', // url encoded 16-31
      '/[\x00-\x08]/', // 00-08
      '/\x0b/', // 11
      '/\x0c/', // 12
      '/[\x0e-\x1f]/'); // 14-31
      foreach ($non_displayables as $regex)
          $data = preg_replace($regex, '', $data);
      $data = str_replace("'", "''", $data);
      return $data;
  }
  
  $host = '127.0.0.1';
  $dbuser = 'Your Login';
  $dbpass = 'Your Password';
  
  $class = array(0 => 'Warrior', 1 => 'Guardian', 2 => 'Assasin', 3 => 'Hunter', 4 => 'Pagan', 5 => 'Oracle', 6 => 'Fighter', 7 => 'Defender', 8 => 'Ranger', 9 => 'Archer', 10 => 'Mage', 11 => 'Priest');
  
  $conn = @odbc_connect("Driver={SQL Server};Server=$host;", $dbuser, $dbpass) or die("Database Connection Error!");
  $UserID = isset($_POST['username']) ? mssql_escape_string(trim($_POST['username'])) : '';
  $Pass = isset($_POST['password']) ? mssql_escape_string(trim($_POST['password'])) : '';
  $Char = isset($_POST['char']) ? mssql_escape_string(trim($_POST['char'])) : '';
  
  if (isset($_POST['submit'])) {
      if (strlen($UserID) < 1)
          die("User Name too short");
      if (strlen($Pass) < 1)
          die("Password too short.");
      
      $res = odbc_exec($conn, "SELECT * FROM [PS_UserData].[dbo].[Users_Master] WHERE UserID = '" . $UserID . "' AND Pw = '" . $Pass . "'"); 
      
      if (odbc_num_rows($res) == 0) {
          die("Username/Password is incorrect");
      } else {
          $res2 = odbc_exec($conn,"SELECT umg.Country, c.Family, c.CharName, c.CharID, c.Job, c.Level
FROM [PS_GameData].[dbo].[UserMaxGrow] AS umg 
INNER JOIN [PS_GameData].[dbo].[Chars] AS c ON umg.UserUID = c.UserUID
WHERE c.UserID = '" . $UserID . "' AND c.Del=1");
          
          if (odbc_num_rows($res2) == 0) {
              echo "<font color=#FFFFFF>Account does not contain any dead characters.";
          } else {
              echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"POST\"><font color=#FFFFFF>Select toon to resurrect :<br />
<input type=\"hidden\" name=\"username\" value=\"" . $UserID . "\">
<table cellspacing=4 cellpadding=5 border=2 style=\"border-style:white;\"><body bgcolor=4D101F>
<tr><td><font color=#FFFFFF>Select</td><td><font color=#FFFFFF>CharName</td><td><font color=#FFFFFF>Class</td><td><font color=#FFFFFF>Level</td></tr>";
              while ($chars = odbc_fetch_array($res2)) {
                  if ($chars['Country'] == 0) {
                      if ($chars['Family'] == 0 || $chars['Family'] == 1) {
                          echo "<tr>";
                          echo "<td><font color=white><input type=\"radio\" name =\"char\" value=\"" . $chars['CharName'] . "," . $chars['CharID'] . "\"></font></td>";
                          echo "<td><font color=white>" . $chars['CharName'] . "</font></td><td><font color=white>" . $class[$chars['Job'] + 6] . "</font></td>";
                          echo "<td><font color=white>" . $chars['Level'] . "</font></td>";
                          echo "</tr>";
                      }
                  } elseif ($chars['Country'] == 1) {
                      if ($chars['Family'] == 2 || $chars['Family'] == 3) {
                          echo "<tr><font color=#FFFFFF>";
                          echo "<td><FONT COLOR=WHITE><input type=\"radio\" name =\"char\" value=\"" . $chars['CharName'] . "," . $chars['CharID'] . "\"></font></td>";
                          echo "<td><font color=white>" . $chars['CharName'] . "</font></td><td><font color=white>" . $class[$chars['Job']] . "</font></td>";
                          echo "<td><font color=white>" . $chars['Level'] . "</font></td>";
                          echo "</tr>";
                      }
                  }
              }
              echo "</table><input type=\"submit\" value=\"Submit\" name=\"submit2\" /></form>";
          }
      }
  } elseif (isset($_POST['submit2'])) {
      $slot = -1;
      $res1 = odbc_exec($conn, "
SELECT MIN(Slots.Slot) AS OpenSlot FROM
(SELECT 0 AS Slot UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4) AS Slots
LEFT JOIN
(SELECT c.Slot
FROM PS_UserData.dbo.Users_Master AS um
INNER JOIN PS_GameData.dbo.Chars AS c ON c.UserUID = um.UserUID
WHERE um.UserID = '" . $UserID . "'
AND c.Del = 0) AS Chars ON Chars.Slot = Slots.Slot
WHERE Chars.Slot IS NULL");
      $slot = odbc_fetch_array($res1);
      $toon2 = explode(',', $Char);
	  $charID = mssql_escape_string($toon2[1]);
	  $openSlot = mssql_escape_string($slot['OpenSlot']);
      if ($slot['OpenSlot'] > -1 && $slot['OpenSlot'] < 5) {
          odbc_exec($conn, "UPDATE PS_GameData.dbo.Chars SET Del=0, Slot={$openSlot}, Map=42, PosX=63 , PosZ=57, DeleteDate=NULL WHERE CharID = {$charID}");
          echo "<body bgcolor=4D101F><font color=white>Successfully resurrected <br /> Login = " . $UserID . "<br />Slot = " . ($slot['OpenSlot'] + 1) . "<br />Char = $toon2[0]</font>";
      } else
          echo "<body bgcolor=4D101F><font color=white>No slots avaliable</font>";
  } else {
?>
<html>
<head>
<title>Character Ressurection</title></head>
<body bgcolor=4D101F>
<form action="<?php
      echo $_SERVER['PHP_SELF'];
?>" method="POST">
<fieldset style="font:100% trebuchet ms;width:0px;">
<legend ><font color=white>Resurrection Form </font></legend>
<font face="Trebuchet MS">
<table>
<tr>
<font size=1><font color=white><i>*Toon will be resurrected in an avaliable free slot.</i></font>
</tr>
<tr>
<td><font color=white>Account Login:</td><td>  <input type="text" name="username" maxlength=20/></td>
</tr>
<tr>
<td><font color=white>Account Password:</td><td><input type="password" name="password" maxlength=20/></td>
</tr>
</font>
</table>
<input type="submit" value="Submit" name="submit" />
</fieldset>
</form>
</body>
</html>
<?php
  }
?>
This is the security fix to prevent SQL Injection. *No 100% guarantee this is perfect but it can't be worse than what you are using now.*

Credits go to Tnelis for the ODBC version rewrite and Abrasive for fixing the security flaw.
So tell the haters to shove it ^_~

Karma
KarmaIsMe is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
Request| Script To Release Stuck Char
01/22/2012 - Dekaron Private Server - 7 Replies
hello, im looking for a script thet can release stuck char and return him back to loa thx for all.
Suche Script das Acc und Char anzahl anzeig
05/04/2010 - Metin2 Private Server - 1 Replies
hey leute suche ein php script das acc und char anzahl anzeigt lg casi
Is there an edited Script/Char Script/Fan Map.kom?
12/09/2009 - Grand Chase Philippines - 6 Replies
Mayroon n b n updated kc matagal n naghihintay ang iba?:confused:
may new char.script na po ba?
10/29/2009 - Grand Chase Philippines - 18 Replies
may updates na po ba sa new cheat?? tnx..:handsdown:
[Release][GC PH] Script and Char script
10/22/2009 - Grand Chase Hacks, Bots, Cheats & Exploits - 27 Replies
Here's the Script and Char_script with yellow lines hope it helped paki crch2 na lang po kasi na delete ko ung crch2 ko if any problems paki post na lang agad Credits to :handsdown::handsdown:Brian~ and Craymel:handsdown::handsdown: Btw... pang range po yan pede rin ung jump attack(Down) ng Dk,ragna bolt,block attack ng Ak,jump attack ng lass ung iba ko pang d nsabi paki banggit na rin



All times are GMT +1. The time now is 10:37.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.