preview

An Approach to Detect and Prevent Sql Injection Attacks in Database Using Web Service

Better Essays

IJCSNS International Journal of Computer Science and Network Security, VOL.11 No.1, January 2011

197

An Approach to Detect and Prevent SQL Injection Attacks in
Database Using Web Service
IndraniBalasundaram 1 Dr. E. Ramaraj2
1

Lecturer, Department of Computer Science, Madurai Kamaraj University, Madurai
2
Director of Computer Centre Alagappa University, Karaikudi.

Abstract
SQL injection is an attack methodology that targets the data residing in a database through the firewall that shields it. The attack takes advantage of poor input validation in code and website administration. SQL Injection Attacks occur when an attacker is able to insert a series of SQL statements in to a
‘query’ by manipulating user input data in …show more content…

The example refers to a fairly simple vulnerability that could be prevented using a straightforward coding fix. This example is simply used for illustrative purposes because it is easy to understand and general enough to illustrate many different types of attacks. The code in the example uses the input parameters LoginID, password to dynamically build an SQL query and submit it to a database. For example, if a user submits loginID and password as
“secret,” and “123,” the application dynamically builds and submits the query:

Manuscript received January 5, 2011
Manuscript revised January 20, 2011

198

IJCSNS International Journal of Computer Science and Network Security, VOL.11 No.1, January 2011

SELECT * from FROM loginID=’secret’ AND pass1=123

user_info

WHERE

If the loginID and password match the corresponding entry in the database, it will be redirect to user_main.aspx page other wise it will be redirect to error.aspx page.

1. dim loginId, Password as string
2. loginId = Text1.Text
3. password = Text2.Text
3. cn.open()
4. qry=”select * from user_info where LoginID=’” & loginID & “’ and pass1=” & password & “”
5. cmd=new sqlcommand(qry,cn)
6. rd=cmd.executereader()
7. if (rd.Read=True) Then
8. Response.redirect(“user_main.aspx”)
9. else
10.

Get Access