• uzair
• Introduction
• Attack Intent
• Real World Examples
• How SQL Injection works?
• Video
• Impact of SQL injection
• Types of attacks
• Hack a website
• Defence Against SQL Injection
• Other Injection Types
• SQL Injection tools
• Conclusion
• On August 17, 2009, the United States Justice Department charged an
American citizen Albert Gonzalez and two Russians with the theft of
130 million credit card numbers using an SQL injection attack.
• In 2008 a sweep of attacks began exploiting the SQL injection
vulnerabilities of Microsoft's IIS web server and SQL database server.
Over 500,000 sites were exploited.
• The ability to inject SQL commands into the database engine through
an existing application
• SQL injection is the use of publicly available fields to gain entry to
your database.
• This is done by entering SQL commands into your form fields instead
of the expected data.
• Improperly coded forms will allow a hacker to use them as an entry
point to your database
Unauthorized Access Attempt:
password = ’ or 1=1 --
SQL statement becomes:
select count(*) from users where username = ‘user’ and password = ‘’ or 1=1 --
Checks if password is empty OR 1=1, which is always true, permitting access.
Database Modification Attack:
password = foo’; delete from table users
where username like ‘%
DB executes two SQL statements:
select count(*) from users where username = ‘user’ and password = ‘foo’
delete from table users where username like ‘%’
What it is?
SQL Injection allows a programmer user specified query
to execute in the database
• Shell injection.
• Scripting language injection.
• File inclusion.
• XML injection.
• XPath injection.
• LDAP injection.
• SMTP injection.
• BSQL Hacker
• SQLmap
• SQLninja
• Safe3 SQL Injector
• SQLSus
• Mole
• Havij
1. Comprehensive data sanitization
• Web sites must filter all user input
• For example, e-mail addresses should be filtered to allow only the
characters allowed in an e-mail address.
• Its SQL injection defenses can catch most attempts to sneak SQL
through web channels.
2. Use a web application firewall
• A popular example is the free, open source module ModSecurity.
• ModSecurity provides a sophisticated and ever-evolving set of rules
to filter potentially dangerous web requests.
3. Limit database privileges by context
• Create multiple database user accounts with the minimum levels of
privilege for their usage environment.
• For example, the code behind a login page should query the database
using an account limited only to the relevent credentials table.
• This way, a breach through this channel cannot be leveraged to
compromise the entire database.
4. Avoid constructing SQL queries with user input
• Even data sanitization routines can be flawed.
• Using SQL variable binding with prepared statements or stored
procedures is much safer than constructing full queries.
• The technique is based on malformed user-supplied data
• Transform the innocent SQL calls to a malicious call
• Cause unauthorized access, deletion of data, or theft of information
• All databases can be a target of SQL injection and all are vulnerable to
this technique.
• The vulnerability is in the application layer outside of the database,
and the moment that the application has a connection into the
database.
• https://www.owasp.org/index.php/Query_Parameterization_Cheat_S
heet#Parameterized_Query_Examples
• www.slideshare.net
• www.beyondsecurity.com
• www.breakthesecurity.cysecurity.org
• http://www.esecurityplanet.com/
• http://resources.infosecinstitute.com/best-free-and-open-source-sql-
injection-tools/

Sql injection

  • 1.
  • 2.
    • Introduction • AttackIntent • Real World Examples • How SQL Injection works? • Video • Impact of SQL injection • Types of attacks • Hack a website • Defence Against SQL Injection • Other Injection Types • SQL Injection tools • Conclusion
  • 3.
    • On August17, 2009, the United States Justice Department charged an American citizen Albert Gonzalez and two Russians with the theft of 130 million credit card numbers using an SQL injection attack. • In 2008 a sweep of attacks began exploiting the SQL injection vulnerabilities of Microsoft's IIS web server and SQL database server. Over 500,000 sites were exploited.
  • 4.
    • The abilityto inject SQL commands into the database engine through an existing application • SQL injection is the use of publicly available fields to gain entry to your database. • This is done by entering SQL commands into your form fields instead of the expected data. • Improperly coded forms will allow a hacker to use them as an entry point to your database
  • 5.
    Unauthorized Access Attempt: password= ’ or 1=1 -- SQL statement becomes: select count(*) from users where username = ‘user’ and password = ‘’ or 1=1 -- Checks if password is empty OR 1=1, which is always true, permitting access.
  • 6.
    Database Modification Attack: password= foo’; delete from table users where username like ‘% DB executes two SQL statements: select count(*) from users where username = ‘user’ and password = ‘foo’ delete from table users where username like ‘%’
  • 7.
    What it is? SQLInjection allows a programmer user specified query to execute in the database
  • 9.
    • Shell injection. •Scripting language injection. • File inclusion. • XML injection. • XPath injection. • LDAP injection. • SMTP injection.
  • 10.
    • BSQL Hacker •SQLmap • SQLninja • Safe3 SQL Injector • SQLSus • Mole • Havij
  • 11.
    1. Comprehensive datasanitization • Web sites must filter all user input • For example, e-mail addresses should be filtered to allow only the characters allowed in an e-mail address. • Its SQL injection defenses can catch most attempts to sneak SQL through web channels.
  • 12.
    2. Use aweb application firewall • A popular example is the free, open source module ModSecurity. • ModSecurity provides a sophisticated and ever-evolving set of rules to filter potentially dangerous web requests.
  • 13.
    3. Limit databaseprivileges by context • Create multiple database user accounts with the minimum levels of privilege for their usage environment. • For example, the code behind a login page should query the database using an account limited only to the relevent credentials table. • This way, a breach through this channel cannot be leveraged to compromise the entire database.
  • 14.
    4. Avoid constructingSQL queries with user input • Even data sanitization routines can be flawed. • Using SQL variable binding with prepared statements or stored procedures is much safer than constructing full queries.
  • 15.
    • The techniqueis based on malformed user-supplied data • Transform the innocent SQL calls to a malicious call • Cause unauthorized access, deletion of data, or theft of information • All databases can be a target of SQL injection and all are vulnerable to this technique. • The vulnerability is in the application layer outside of the database, and the moment that the application has a connection into the database.
  • 16.
    • https://www.owasp.org/index.php/Query_Parameterization_Cheat_S heet#Parameterized_Query_Examples • www.slideshare.net •www.beyondsecurity.com • www.breakthesecurity.cysecurity.org • http://www.esecurityplanet.com/ • http://resources.infosecinstitute.com/best-free-and-open-source-sql- injection-tools/