Attacchi da iniezione di comandi SQL Ataques por injeção de encomendas SQL Angriffe durch die Einschleusung von SQL Befehlen Attaques par injection de commandes SQL Ataques de inyección SQL

SQL Injection

SQL injection attacks are attacks against websites that rely on relational databases.

In this type of site, parameters are passed to the database in the form of an SQL query. As such, if the designer does not verify the parameters passed in the SQL query, a hacker can modify the query in order to access the entire database and even to modify its content.

Some characters make it possible to string together several SQL queries or to ignore the rest of the query. By inserting this type of character in the query, a hacker can potentially execute the query of his choice.

Given the following query, waiting for a user name as a parameter:

SELECT * FROM users WHERE name="$name";

A hacker simply needs to enter a name such as "toto" OR 1=1 OR name ="titi" for the query to become as follows:

SELECT * FROM users WHERE name="toto" OR 1=1 OR name ="titi";

With the above query, the WHERE clause is always performed, which means it will return records that correspond to all users.

Stored procedures

Moreover, some database management systems such as Microsoft SQL Server have stored procedures that make it possible to launch administration commands. These stored procedures are potentially dangerous in that they can make it possible for a malicious user to execute system commands that may lead to a possible intrusion.

Countermeasures

A number of rules can help you protect yourself against SQL injection attacks:

  • Verify the format of input data and particularly the presence of special characters;
  • Do not display explicit error messages displaying the query or a part of the SQL query;
  • Delete unused user accounts, and particularly default accounts;
  • Avoid accounts without passwords;
  • Keep the privileges of used accounts to a minimum;
  • Delete stored procedures.


Last update on Thursday October 16, 2008 02:43:15 PM.This document entitled « SQL injection attacks » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.
Best answers for « SQL injection attacks » in :
Cross-Site Scripting attacks Show Malicious code injection Cross-Site Scripting (sometimes abbreviated XSS or CSS) attacks are attacks targeting websites that dynamically display user content without checking and encoding the information entered by users. Cross-Site Scripting...
Ping of death attack Show Ping of death attack The ping of death attack is one of the oldest network attacks. The principle of ping of death simply involves creating an IP datagram whose total size exceeds the maximum authorized size (65,536 bytes). When such a packet is...
LAND attack Show LAND attack The "LAND attack" is a network attack dating from 1997 using IP address spoofing to exploit a flaw on some TCP/IP protocol implementations in systems. The name of this attack comes from the name given to the first distributed source...
Automatic backup of a Database in SQL EXPRESS 2005 ShowAutomatic backup of a Database in SQL EXPRESS 2005 If you want to automate a backup of a database in SQL Server Express, there is a simple solution using a .bat. file. Create a new text file. This file should contain the following...
Visual FoxPro and SQL Server ShowVisual FoxPro and SQL Server Visual Foxpro 9 and SQL Server 2005 Is there a better alternative than using Visual FoxPro to manage efficiently a SQL Server? Here's an interesting issue. For more information see the article:...
[SQL] avoid duplicates when using SELECT Show[SQL] avoid duplicates when using SELECT Issue How to avoid duplicates in the results of a SQL query? Solution Simply use the DISTINCT clause and between the SELECT clause and the fields. Example: SELECT distinct...
Nuke attack ShowNuke attack Nukes are Window crashes caused by dimwitted users (who know your IP address) who decide to use a Windows 95 (not 98) bug where if someone repeatedly sends information packets to port 139, Windows displays a lovely and impressive blue...
Denial of service attack ShowIntroduction to denial-of-service attacks A "denial-of-service attack" (abbreviated DoS) is a type of attack that aims to make an organization's services or resources unavailable for an indefinite amount of time. Most of the time, these attacks are...
Teardrop attack ShowFragment attack A "fragment attack" is a network saturation (denial-of-service) attack that exploits the fragmentation principle of the IP protocol. The IP protocol is used to fragment large packets into several IP packets each having a sequence...