our advertising disclaimer | Disclaimer - Must be read before using forum or clicking any links
NordFX.com
BlockDos.net hosting
YOUR AD HERE!
For only $17/day, $99/week or $379/month on the most Popular HYIP related site online!
TURN SPORT INTO CASH. $1,000 Minimum Deposit / $200 Referral Bonus
Since 2008. 4%-10% Weekly, Zero Risk Arbitrage Betting Pool, Credit Cards, Bank Transfer, PM, LR, C-Gold, LiveChat, DDOS
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, 10: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-15-2006, 11:34 PM
neversay's Avatar
neversay neversay is offline
"Talkgold's Best" Club
Join Date: Nov 2005
Posts: 2,090
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');
__________________
PHP programmer find me here
Reply With Quote
  #3  
Old 06-15-2006, 11:47 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 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-15-2006, 11:50 PM
neversay's Avatar
neversay neversay is offline
"Talkgold's Best" Club
Join Date: Nov 2005
Posts: 2,090
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.
__________________
PHP programmer find me here
Reply With Quote
  #5  
Old 06-16-2006, 12:00 AM
CashMonster's Avatar
CashMonster CashMonster is offline
Folder Moderator
Join Date: May 2006
Posts: 2,228
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, 12: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, 01: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, 05:57 AM
mupegasus's Avatar
mupegasus mupegasus is offline
"Talkgold's Best" Club
Join Date: Aug 2005
Posts: 2,427
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, 06:04 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

Pretty much every script that connects to an SQL database without protection is vulnerable.
Reply With Quote
  #10  
Old 06-16-2006, 06:34 AM
neversay's Avatar
neversay neversay is offline
"Talkgold's Best" Club
Join Date: Nov 2005
Posts: 2,090
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.
__________________
PHP programmer find me here
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 $320/WEEK!
Click Here for details.
Your ad here! Cost of Ad - $310
Your ad here! Cost of Ad - $300
Cost of Ad - $240
Your ad here! Cost of Ad - $230
Your ad here! Cost of Ad - $200
Your ad here! Cost of Ad - $190
Your ad here! Cost of Ad - $180
Your ad here! Cost of Ad - $140
Your ad here! Cost of Ad - $130
BlockDOS.net
The absolute best DDOS Protection at the most affordable prices. Endorsed by Talkgold.com

Cost of Ad - $110
Instaforex Cost of Ad - $95
Your ad here! Cost of Ad - $80
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!
WWW.CYBERCOBRA.COM - Get DDOS Protection!

CyberCOBRA.com it's a multihomed hosting provider, specializes in high quality offshore hosting services, dedicated servers management and DoS/DDoS mitigation technologies.

Only $39/week or $135/month - Advertise Now!
GOLD CAST

250% After 10 Minutes [Instant Payment]
800% After 3 Hour [Instant Payment]
1400% After 10 Hour [Instant Payment]
2500% After Only 1 Day [Instant Payment]
Www.Gold-Cast.Com
Only $39/week or $135/month - Advertise Now!
Check our Advertising Rates!

All times are GMT. The time now is 08:34 PM.

Add to Google

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