Add to Google

What Are Sql Interjection Attacks? - (Answer inside)

Pages: 1, 2, 3
free web hosting

Read Latest Entries..: (Post #22) by Adamrosso on Aug 8 2005, 07:51 PM. (Line Breaks Removed)
Interesting topic. I will defantly read this more often if it happens to me
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > CONTRIBUTE > What Is...?

What Are Sql Interjection Attacks? - (Answer inside)

sirhenry
Yikes! I just found out about this. It's really something to watch out for when making SQL of any sort, not just log-ins. Fortunately, it's relatively easy to circumvent.

Check it out:

QUOTE("A man wiser than I")
What is an SQL Injection attack?

An SQL Injection attack happens when a user gives your script data crafted to change your SQL to do something you didn't intend it to do. Consider this SQL:

$sql = 'SELECT * FROM users WHERE username="'.$username.'"
AND password="'.$password.'"';
if (mysql_query($sql)) {
  echo 'Logged in!';
}

It looks fine, but what if a user submitted this as their password:

" OR 1=1 OR ""="

This would cause the SQL to read:

SELECT * FROM users WHERE username="" AND password="" OR 1=1 OR ""=""

which would allow the attacker to get into your system without even knowing a login!

On many databases you can also run multiple queries by putting a semicolon in the SQL you pass. Consider this password:

"; DELETE FROM users WHERE ""="

This would run the first query, which would probably find no records, but it would then run the DELETE query which would delete all of yoru users. Note that this could also be used to delete any other data in yoru system or to change your data or insert a new user with admin priviledges.

To protect against this, you need to "escape" the variables you put into your SQL. When using Mysql you can do this:


$sql = 'SELECT * FROM users WHERE
username="'.mysql_real_escape_string($username).'" AND
password="'.mysql_real_escape_string($password).'"';


If you're using PEAR::DB you can do this (this will work for *any* database system that DB supports):

$sql = 'SELECT * FROM users WHERE
username='.$db->quoteSmart($username).' AND
password='.$db->quoteSmart($password);



Pretty scary stuff, huh? ::shocked::


Note: this is taken from this wiki, and the rightful author(s) of this information deserve all credit due.

 

 

 


Reply

Xedos
Wow. I've knew about SQL Interjections for ages. I however never knew what they did. This as explained it all to me. Thanks!

Reply

maddog39
I know someone who had and sql injection attack on there phpBB forum and the hacker logged into the ACP and kaked everything and left a message on his homepage, lol. biggrin.gif

Reply

Roly
or you can use htmlentites() or addslashes()

Reply

OpaQue
This is a very helpful information that you have contributed! And it must be known by many programmers.

I have Granted you 2 Hosting Credits as reward! smile.gif

Reply

King-Squad
What are hosting credits by the way?

Reply

OpaQue
http://www.trap17.com/forums/

Reply

King-Squad
ooo gotcha thank you i wasnt paying attention sorry

Reply

maddog39
Its been like 1 or 2 days and I have 20 credits from my original starting 3, lol. blink.gif biggrin.gif

Reply

Xedos
What? Your giving out hosting credits?

Your nice.

*Cough*Isaidyournicenowgiveme5000credits*Cough*

Reply

Latest Entries

Adamrosso
Interesting topic. I will defantly read this more often if it happens to me biggrin.gif

Reply

s2city
Thanks for posting... good idea to inform everyone of the dangers involving databases. Also.. they're called SQL Injections... not Interjections. Common misconception... not really, actually.

Reply

SecureA
well, nice article,thanks

Reply

BuffaloHELP
Dynomite

Please do not hijack the thread. Stay on the topic. We have dedicated PHP programming subforum or you can search for phpBB modification with the popular search engines.

Reply

Dynomite
Thank you for posting this. Are SQL Injections what cause all of the phpBB exploits? I know it was something like that. I really like phpBB boards, I'm trying to learn php more advance than whay I know already, which is basic things like.
echo "Text Here";
date("D")
if...else
switch
$variable
etc...
I want to make some really great phpBB hacks, I've been looking at the phpBB code for a while now, I think if I can understand everything in it I should be doing alright. I'll also know the structure of the software and how it works, that should help me make some modifications for it.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2, 3
Recent Queries:-
  1. sql interjections - 62.16 hr back. (3)
  2. sql attack phpbb - 255.44 hr back. (1)
  3. interjection - 287.80 hr back. (1)
  4. phpbb why quote variables in sql query - 350.28 hr back. (1)
  5. read password from phpbb sql - 565.47 hr back. (1)
  6. what is the interjections sign - 573.80 hr back. (1)
  7. mysql 2 hack sql or 1=1 delete - 648.39 hr back. (1)
  8. sql injection walmart - 727.32 hr back. (1)
  9. mysql database interjections - 759.97 hr back. (1)
  10. sql query in interjection - 1066.72 hr back. (1)
  11. what is a interjection - 1332.79 hr back. (1)
  12. "sql interjection" - 1438.32 hr back. (3)
  13. quotesmart sql injection - 1496.79 hr back. (2)
  14. sql interjection - 40.13 hr back. (38)
Similar Topics

Keywords : sql interjection attacks inside


    Looking for sql, interjection, attacks, answer, inside






*SIMILAR VIDEOS*
Searching Video's for sql, interjection, attacks, answer, inside

*MORE FROM TRAP17.COM*
advertisement



What Are Sql Interjection Attacks? - (Answer inside)



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE