» PHP - Prevent SQL Injection || Website Security Tips March 29 2010
Wifi Hacking Adapter : Recommended by Rahul Tyagi
PHP - Prevent SQL Injection || Website Security Tips March 29 2010
SQL injection vulnerabilities have been described as one of the most serious threats for Web applications. Web applications that are vulnerable to SQL injection may allow an attacker to gain complete access to their underlying databases.
Because these databases often contain sensitive consumer or user information, the resulting security violations can include identity theft, loss of confidential information, and fraud. In some cases, attackers can even use an SQL injection vulnerability to take control of and corrupt the system that hosts the Web application.
SQL injection refers to a class of code-injection attacks in which data provided by the user is included in an SQL query in such a way that part of the user’s input is treated as
SQL code.By lever-aging these vulnerabilities, an attacker can submit SQL commands directly to the database. These attacks are a serious threat to any Web application that receives input from users and incorporates it into SQL queries to an underlying database.
The cause of SQL injection vulnerabilities is relatively simple and well understood: insufficient validation of user input.
Types of SQL injection attacks:
In union-query attacks, an attacker exploits a vulnerable parameter to change the data set returned for a given query. With this technique, an attacker can trick the application into returning data from a table different from the one that was intended by the developer.
Attackers do this by injecting a statement of the form: UNION SELECT .
Because the attackers completely control the second/injected query, they can use that query to retrieve information from a specified table.
The result of this attack is that the database returns a dataset that is the union of the results of the original first query and the results of the injected second query. 1: 2: 3: SELECT accounts FROM users WHERE login='' UNION SELECT cardNo from CreditCards where acctNo=10032 -- AND pass='' AND pin=
Assuming that there is no login equal to , the original first query returns the null set, whereas the second uery returns data from the CreditCards table. In this case, the database would return column cardNo for account 10032. The database takes the results of these two queries, unions them, and returns them to the application.
In many applications, the effect of this operation is that the value for cardNo is displayed along with the account information.
Views: 861 |