If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > SQL Injection - ATTENTION

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-02, 13:33
MGZ MGZ is offline
Registered User
 
Join Date: Apr 2002
Location: Calgary, Canada
Posts: 30
SQL Injection - ATTENTION

http://207.230.217.78/chris/sqlinjection.zip

This article points out a flaw/weakness in some DB servers called SQL Injection. the concept is very similar to CSS (cross-site scripting.) the following code is in ASP/MS SQL but it should make sense across the platforms.

lets say you have a simple HTML form that has a single textbox where the user enters their name. on the server-side you have the following code:

Code:
SELECT * FROM Users WHERE Username='" & Request.Form("Username") & "'"
if a person enters Bob into the user name box, the query sent to the SQL server would be:
Code:
SELECT * FROM Users WHERE Username='Bob'
that's great and all, but what if the user entered:

Code:
Bob' DROP TABLE Users--
this would send the following code to the server:

Code:
SELECT * FROM Users WHERE Username='Bob' DROP TABLE Users--'
since MS SQL pretty much ignores whitespace, it's going to execute both commands, the second of which deletes the entire user table. the 2 dashes are SQL comments so the last apostrophe gets ingored and no errors are thrown.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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