CashTanker
Happy Investing, With Happy Christian Community
 
our advertising disclaimer | Disclaimer - Must be read before using forum or clicking any links
arbsfund.com
Major-gain
$500 SIGNUP bonus! Limited time offer! Pays 15%-30% daily at Global-Fund.Net
$500 signup bonus - 10% referal bonus - $10,000 monthly to win
Rating A**** 4,000 MEMBERs and growing - Cassie Johnson pays 12% Daily at iMoneyReserve.com
*** EXPRESS CashOut Daily - BONUS upto $1,200 - VIP Customer Support - 12% RefCom - Top Management and Admin ***
Put your banner or text ad in the rotation above!ONLY $17/day, $99/week, or $379/month!


Your Ad Here
Your Ad Here

above banners and links are advertisements only. We do not endorse or vouch for any advertisers.Put Your 728X90 Banner Here NOW!

Go Back   Talkgold HYIP, Investment & Money Forum > Caution : Risky High Yield Investing Programs > HYIP - AutoSurf Program Admin Talk
User Name
Password
Reply
 
Thread Tools Display Modes
  #1  
Old 06-15-2006, 11:21 PM
Test33's Avatar
Test33 Test33 is offline
Senior Investor
Join Date: Jan 2006
Location: Biggest Little City in the World
Posts: 609
Send a message via AIM to Test33 Send a message via MSN to Test33 Send a message via Yahoo to Test33
Default SQL Injection - A simple way to prevent

Alright, I've made a post on another thread with this way.

By turning ON magic quotes this should stop most SQL injections. I haven't done a lot of testing, but I have not be able to inject anything into my MySQL database.

Here is how you would do an SQL injection.

Code:
"a'; DROP TABLE users; SELECT * FROM data WHERE name LIKE '%"
in the place of username/password etc fields. Now, with magic quotes off, this is the full sql query

Code:
SELECT * FROM users WHERE name = 'a'; DROP TABLE users; SELECT * FROM data WHERE name LIKE '%';
This would stop the sql code from being executed.

Now, this is what it would look like with magic quotes on

Code:
SELECT * FROM users WHERE name = 'a\'; DROP TABLE users; SELECT * FROM data WHERE name LIKE \'%';
Remember, that this will not stop all sql injections, but it should stop most of them.

Since, I do not have a reputation here, at least I don't think I do. I'll give you the tutorial on how to do it, right here, free. Then you can contact me if you still need help.

Since most people today just run shared hosting, you do not have access to your php.ini, but I also found out, that it is possible to do it from your .htaccess file, however, it doesn't always work. So instead all you need to use is the "addslashes" function.
  1. Open the file that you want to add the function to.
  2. Find the variable that you want to add slashs to. I'll call it $a;
  3. Below it, add $a = addslashes($a);

Make sure your names for the variables are correct. You should have basic knowledge of PHP before attempting this.

If you have access to your php.ini just do this:
  1. Open php.ini
  2. Find magic_quotes_gpc off
  3. change off to on

This will affect ALL your scripts, and might not be good, but it's the easy way out.


Now, I haven't looked too much at GC HYIP script, since the code is messy =P. But I'll try to add a function to make it easier for all of you. Or unless, naversay wants to, or if he already has.

I want other people to list their ways of 'patching' this problem up. I'm sure their are better ways then using addslashes function. So post it. Also, tell me if this will work or wont work. I've only tested it on my projects, 'cause I can read the code =)
Reply With Quote
-- Sponsored Links --
  #2  
Old 06-16-2006, 12:34 AM
neversay's Avatar
neversay neversay is offline
"Talkgold's Best" Club
Join Date: Nov 2005
Posts: 2,115
Send a message via Yahoo to neversay
Default Re: SQL Injection - A simple way to prevent

Well this is the function to test if you magic quote is on

$gpc = ini_get ('magic_quotes_gpc');
Reply With Quote
  #3  
Old 06-16-2006, 12:47 AM
Test33's Avatar
Test33 Test33 is offline
Senior Investor
Join Date: Jan 2006
Location: Biggest Little City in the World
Posts: 609
Send a message via AIM to Test33 Send a message via MSN to Test33 Send a message via Yahoo to Test33
Default Re: SQL Injection - A simple way to prevent

Also noted, that magic quotes will not be implanted in PHP6. Even though, almost everyone is still on PHP4.

You can set it using the set magic quotes function, however, for some reason it doesn't not work with my server, so I did not add that to my post above, as I wouldn't be able to support it.
Reply With Quote
  #4  
Old 06-16-2006, 12:50 AM
neversay's Avatar
neversay neversay is offline
"Talkgold's Best" Club
Join Date: Nov 2005
Posts: 2,115
Send a message via Yahoo to neversay
Default Re: SQL Injection - A simple way to prevent

That's what I've been doing.
I just filtering user input that is related to sql queries myself.
Reply With Quote
  #5  
Old 06-16-2006, 01:00 AM
CashMonster's Avatar
CashMonster CashMonster is offline
Folder Moderator
Join Date: May 2006
Posts: 2,227
Send a message via MSN to CashMonster
Default Re: SQL Injection - A simple way to prevent

Very helpful thanks
__________________
www.SuboHost.com
Cheap Reliable Hosting!

Reply With Quote
  #6  
Old 06-16-2006, 01:42 AM
Test33's Avatar
Test33 Test33 is offline
Senior Investor
Join Date: Jan 2006
Location: Biggest Little City in the World
Posts: 609
Send a message via AIM to Test33 Send a message via MSN to Test33 Send a message via Yahoo to Test33
Default Re: SQL Injection - A simple way to prevent

Alright, I think this might work, but I have not tested it. I will later, but I just wanted to get you take on it.

For the GC HYIP, at line (or around) 26, where you have $resualt = mysql_query($query)...
If you place above that $query = $ addslashes($query); then it should place the slashes into the all queries of the HYIP.
Reply With Quote
  #7  
Old 06-16-2006, 02:01 AM
ballerz's Avatar
ballerz ballerz is offline
Banned
Join Date: May 2005
Posts: 341
Default Re: SQL Injection - A simple way to prevent

Thanks Test33 !
Reply With Quote
  #8  
Old 06-16-2006, 06:57 AM
mupegasus's Avatar
mupegasus mupegasus is offline
"Talkgold's Best" Club
Join Date: Aug 2005
Posts: 2,428
Default Re: SQL Injection - A simple way to prevent

The sql injection is only against hyip /autosurf sites?

Do I need to care about this if I own an online storaor monitor site?
Reply With Quote
  #9  
Old 06-16-2006, 07:34 AM
neversay's Avatar
neversay neversay is offline
"Talkgold's Best" Club
Join Date: Nov 2005
Posts: 2,115
Send a message via Yahoo to neversay
Default Re: SQL Injection - A simple way to prevent

Quote:
Originally Posted by mupegasus
The sql injection is only against hyip /autosurf sites?

Do I need to care about this if I own an online storaor monitor site?
You should care about it as well.
Reply With Quote
  #10  
Old 06-16-2006, 07:47 AM
mupegasus's Avatar
mupegasus mupegasus is offline
"Talkgold's Best" Club
Join Date: Aug 2005
Posts: 2,428
Default Re: SQL Injection - A simple way to prevent

Quote:
Originally Posted by neversay
You should care about it as well.

How to test?
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


TALKGOLD
SIDEBAR ADS

ADVERTISE HERE. Must read: Advertising Terms & Disclaimer
PUT YOUR 120X120 AD HERE FOR ONLY $530/WEEK!
Click Here for details.
Your ad here! Cost of Ad - $520
Your ad here! Cost of Ad - $510
Your ad here! Cost of Ad - $500
Your ad here! Cost of Ad - $470
Your ad here! Cost of Ad - $460
Your ad here! Cost of Ad - $440
Your ad here! Cost of Ad - $410
Your ad here! Cost of Ad - $310
Your ad here! Cost of Ad - $300
Your ad here! Cost of Ad - $230
Cost of Ad - $200
Your ad here! Cost of Ad - $190
Your Ad Here Cost of Ad - $120
Your Ad Here Cost of Ad - $110
Your Ad Here Cost of Ad - $105
Cost of Ad - $100
Your Ad Here Cost of Ad - $100
Instaforex Cost of Ad - $95
Your ad here! Cost of Ad - $80
Cost of Ad - $75
Your ad here Cost of Ad - $75
Your ad here Cost of Ad - $75
Your ad here Cost of Ad - $75
YOUR AD HERE

PUT YOUR NON-ROTATING AD HERE NOW!
ONLY $75/Week


click here
click here
YOUR AD HERE!
YOUR AD HERE!
Well Profit

1500% - 2000% After 1 Day, 3200% - 4200% After 2 Days

Only $39/week or $135/month - Advertise Now!
GENIUS PROFIT

250% After 10 Minutes (Instant Withdrawal)
800% After 3 Hour (Instant Withdrawal)
1400% After 10 Hour (Instant Withdrawal)
2500% After 24 Hour (Instant Withdrawal)
Www.Genius-Profit.Com
Only $39/week or $135/month - Advertise Now!
Check our Advertising Rates!

All times are GMT. The time now is 04:15 PM.

Add to Google

Protected by BlockDOS.net - DDOS Protection
Powered by: vBulletin - Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.