Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Shaiya > Shaiya Private Server > Shaiya PServer Guides & Releases
You last visited: Today at 00:46

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

Advertisement



[Release] processor.php protection for potential security risk

Discussion on [Release] processor.php protection for potential security risk within the Shaiya PServer Guides & Releases forum part of the Shaiya Private Server category.

Reply
 
Old   #1
 
il.mane's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 32
Received Thanks: 39
[Release] processor.php protection for potential security risk

if you are useing the processor.php script, you need to know that is potentially attackable with code ijections.

Here is a little solution that may help ya to fix SQL code injection, put this code at the beginning of your processor.php

Code:
function sql_quote( $value )
{
    if( get_magic_quotes_gpc() )
    {
          $value = stripslashes( $value );
    }
    //check if this function exists
    if( function_exists( "mysql_real_escape_string" ) )
    {
          $value = mysql_real_escape_string( $value );
    }
    //for PHP version < 4.3.0 use addslashes
    else
    {
          $value = addslashes( $value );
    }
    return $value;
}
il.mane is offline  
Thanks
4 Users
Old 08/22/2010, 19:55   #2
 
ProfNerwosol's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 449
Received Thanks: 644
Vulnerable to code injections in what way?
ProfNerwosol is offline  
Old 08/22/2010, 23:05   #3
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by ProfNerwosol View Post
Vulnerable to code injections in what way?
The original script takes whatever the user enters as the "userid" and "pass" and inserts them directly into the queries, no questions asked.

There's actually a large number of problems with the original script, SQL injection being the most severe by far.

Another problem is how the last ID is obtained:
Code:
SELECT Max(UserUID) AS max FROM PS_UserData.dbo.Users_Master
This method leaves it open for a race condition in which two users could get the same max UserUID. This is because the script doesn't know of the existence of any other running instances of itself asking the database for the same thing.

Something like this should be used instead:
Code:
SELECT IDENT_CURRENT('Users_Master')
There is a lot of problems with the database as well: missing primary keys, incorrect identity columns, and missing unique constraints to name a few.
abrasive is offline  
Old 08/23/2010, 19:32   #4
 
elite*gold: 0
Join Date: May 2009
Posts: 118
Received Thanks: 77
Would you good sir make a complete file and make it available for the nub user like myself? Thanks in advance

Quote:
Originally Posted by abrasive View Post
The original script takes whatever the user enters as the "userid" and "pass" and inserts them directly into the queries, no questions asked.

There's actually a large number of problems with the original script, SQL injection being the most severe by far.

Another problem is how the last ID is obtained:
Code:
SELECT Max(UserUID) AS max FROM PS_UserData.dbo.Users_Master
This method leaves it open for a race condition in which two users could get the same max UserUID. This is because the script doesn't know of the existence of any other running instances of itself asking the database for the same thing.

Something like this should be used instead:
Code:
SELECT IDENT_CURRENT('Users_Master')
There is a lot of problems with the database as well: missing primary keys, incorrect identity columns, and missing unique constraints to name a few.
jamessimpler is offline  
Old 08/24/2010, 19:06   #5
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by jamessimpler View Post
Would you good sir make a complete file and make it available for the nub user like myself? Thanks in advance
I don't have php set up to connect to mssql to test it. Also after the changes to the database that have been made, whatever I came up with wouldn't work on anyone else's server anyways.
abrasive is offline  
Old 08/24/2010, 22:15   #6
 
ProfNerwosol's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 449
Received Thanks: 644
Quote:
Originally Posted by abrasive View Post
What about stored procedures? Will MSSQL server know about the same procedure being run twice or more and create a queue?
ProfNerwosol is offline  
Old 08/24/2010, 23:44   #7
 
abrasive's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 262
Received Thanks: 809
Quote:
Originally Posted by ProfNerwosol View Post
What about stored procedures? Will MSSQL server know about the same procedure being run twice or more and create a queue?
In the case that you are doing a Select MAX(UserUID), no it's not going to care at all about that. It wants to finish the stored procedures execution as quickly as possibly to get on with other tasks, so it will optimize accordingly.

The best solution to adding new users and new UserUIDs is to set that column to auto-increment. Then when you add a new user, don't pass in a value for that column, and MSSQL will generate it by default when it inserts the row.

That way there's no possible way for any overlap to happen.
abrasive is offline  
Thanks
3 Users
Reply


Similar Threads Similar Threads
[Release][Method]Aeria - Bypass Attack speed hack protection
07/23/2023 - 12Sky2 Hacks, Bots, Cheats & Exploits - 69 Replies
Heya all as you are now awear alt1 has patched the attack speed hack. This is how I have worked arround it. Please Alt1 Patch it SERVER SIDE for once. First I found the attack speed buff as one usally does. Had help from jax on that :D. 010d0ecb Then we noticed it had a limiter when we tried to freeze it to anything above 20 or 21 it just did not work. Here is how to bypass it.
[RELEASE] BruteForce Protection
08/19/2010 - CO2 PServer Guides & Releases - 12 Replies
Hello. I came up with the idea to create a class that will help you protect your server from brute force hackers. Chances aren't very big this will happen to you, but still, a good server should be prepared. Well this release includes the base for it. Explanation: When a wrong password is entered, a new Entry is created, and added to a dictionary, every time a wrong password is entered, this entry will be updated and the TimesTried integer will increase by 1. When this integer reaches a...
1 Jahr AVG Internet Security / AVG Antivirus / Identity Protection™
07/15/2010 - Trading - 1 Replies
Verkaufe: AVG Identity Protection™ 1 Jahr für 5€ Paysafecard: http://www.avg.com/stc/img/box_ais_mr_l.png AVG Identity Protection™ Top-aktuelle Sicherheit für Online-Banking und -Shopping Je mehr Zeit Sie online verbringen, umso wichtiger wird der Schutz Ihrer persönlichen Informationen. Virenschutz allein reicht nicht aus, um auch Ihre Shopping- und Banking-Aktivitäten sicher zu schützen. Welches Virenprogramm Sie auch verwenden, Sie brauchen die zusätzliche Sicherheit durch den AVG...
One Processor
12/19/2009 - Silkroad Online - 3 Replies
hey guys, i just wanna ask what does "one processor" in the loader does?
[Release] Packet Security
11/01/2008 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 10 Replies
Im getting bored of messing around with 2Moons, even though it was a short tyme, so im giving what ive figured out about the packet security to you guys so you can do something with it if u kno how. Well c ya guyz on anotha game if im interested in one :). /************************************************ * * PACKET SECURITY * ************************************************/



All times are GMT +2. The time now is 00:46.


Powered by vBulletin®
Copyright ©2000 - 2024, 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 ©2024 elitepvpers All Rights Reserved.