Current location: Hot Scripts Forums » Programming Languages » PHP » Another Text Based PHP Coding Exploit


Another Text Based PHP Coding Exploit

Reply
  #1 (permalink)  
Old 06-07-06, 03:48 AM
xaaroncx xaaroncx is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Another Text Based PHP Coding Exploit

Hey, On My Text Based Game, Bank has a very serious exploit where you can send your self money, but replacing a vowel in your name with á Like ááron
Can anyone explain how to fix this.
Thanks.

Last edited by xaaroncx; 06-07-06 at 03:53 AM.
Reply With Quote
  #2 (permalink)  
Old 06-07-06, 06:35 AM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Could you post the source code? It'd make it much easier to help you.
Reply With Quote
  #3 (permalink)  
Old 06-07-06, 09:27 AM
xaaroncx xaaroncx is offline
Newbie Coder
 
Join Date: Jan 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Code:

if (trim(strtolower($to_person)) == trim(strtolower($username))){



    echo 
"You cannot send the money to yourself"

    }elseif (
strtolower($to_person) != strtolower($username)){ 
Reply With Quote
  #4 (permalink)  
Old 06-07-06, 10:18 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
are you saying that "à" is the same as "a"?
when comparing "à" to "a" this will certainly return false:
PHP Code:

if("à" != "a"){

  echo 
"no match to be found, so i was right";
}else{
  echo 
"i was wrong";

when testing (click here), it seems i'm right

Greetz,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #5 (permalink)  
Old 06-07-06, 10:44 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
I think what he is getting at is that the logic in his comparison is saying that these are not equal, then it executes the following code to send the money, but that code (probably mysql, due to character set/language/colation...) is matching this to the "a" version of the name and giving the money back to the same person.

Could you post the following code that process this when it thinks the names are different.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Reply With Quote
  #6 (permalink)  
Old 06-07-06, 10:20 PM
ngcomputing's Avatar
ngcomputing ngcomputing is offline
Newbie Coder
 
Join Date: Jun 2006
Location: Florida
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Check the documentation here as well, there are some examples dealing with character conversions from other character sets.

http://us3.php.net/manual/en/function.recode-string.php


Try strcmp() or $mystr===$thisstr (yes three === signs) which does a binary comparison. Check the php docs for more info on the strcmp() string function.

Last edited by ngcomputing; 06-07-06 at 10:37 PM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Your HelP! Loading Multiple External Text into Multiple Dynamic Text Fields Flash_Boi Flash & ActionScript 2 03-30-06 03:27 PM
PHP Redirect Script based on User Text Field skipcollege Script Requests 7 09-18-05 11:03 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
text based php game very IMPORTANT kyeran13 PHP 0 05-01-04 01:03 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM


All times are GMT -5. The time now is 07:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.