Search
Social Media - Mubix
Login
« Free CCNA Study Guide | Main | PDF JS Fuzzer »
Wednesday
Aug182010

ASP SQL Injection Example Code

I had to search high and low for ASP code that was injectable to test some code out and I didn't want to loose the link or the code so here are both:

http://articles.sitepoint.com/article/sql-injection-attacks-safe

 

<% 

dim userName, password, query 
dim conn, rS 

userName = Request.Form("userName") 
password = Request.Form("password") 

set conn = server.createObject("ADODB.Connection") 
set rs = server.createObject("ADODB.Recordset") 

query = "select count(*) from users where userName='" &  
userName & "' and userPass='" & password & "'" 

conn.Open "Provider=SQLOLEDB; Data Source=(local);  
Initial Catalog=myDB; User Id=sa; Password=" 
rs.activeConnection = conn 
rs.open query 

if not rs.eof then 
response.write "Logged In" 
else 
response.write "Bad Credentials" 
end if 

%>

 

 

 

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

thanks for the code mubix

September 14, 2010 | Unregistered Commenterk0n$0l3

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>