12
Aniket Joshi Justin Thomas

Aniket Joshi Justin Thomas

  • Upload
    gilead

  • View
    38

  • Download
    0

Embed Size (px)

DESCRIPTION

Aniket Joshi Justin Thomas. Agenda. Introduction to SQL Injection SQL Injection Attack SQL Injection Prevention Summary. What is SQL Injection?. It is a kind of web application attack where user supplied input coming from: URL : www.abc.com?id=1 Login forms: username=John Doe - PowerPoint PPT Presentation

Citation preview

Page 1: Aniket Joshi Justin Thomas

Aniket JoshiJustin Thomas

Page 2: Aniket Joshi Justin Thomas

Agenda

• Introduction to SQL Injection

•SQL Injection Attack

•SQL Injection Prevention

•Summary

Page 3: Aniket Joshi Justin Thomas

What is SQL Injection?

• It is a kind of web application attack where user supplied input coming from:

• URL: www.abc.com?id=1• Login forms: username=John Doe• Other elements such as cookie, HTTP headers

is manipulated so that vulnerable application executes SQL commands injected by attacker.

Page 4: Aniket Joshi Justin Thomas

Methods of Injection

• Injection into source code of website

• Injection into the URL

Page 5: Aniket Joshi Justin Thomas

SQL Injection cont.…•The injection process works by prematurely

terminating a text string and appending a new command.

•Because the inserted command may have additional strings appended to it before it is executed, the attacker terminates the injected string with a comment mark "--".

•Subsequent text is ignored at execution time.

Page 6: Aniket Joshi Justin Thomas

Example:Statement=“SELECT * FROM users WHERE uname=‘ ”+username+” ’;”

username=‘ or ‘1’=‘1’- -’

SELECT * FROM users WHERE uname=‘ ‘ OR ‘1’=‘1’ - -’;

Page 7: Aniket Joshi Justin Thomas

How to Defend?

Page 8: Aniket Joshi Justin Thomas

How to avoid SQL Injection

•As long as injected SQL code is syntactically correct, tampering cannot be detected programmatically.

•Therefore, you must validate all user input and carefully review code that executes constructed SQL commands in the server that you are using.

Page 9: Aniket Joshi Justin Thomas

Some tips:

•Filter and validate all input data

•Separating code from data by making use of prepared and stored procedures

•Making use of escape characters

Page 10: Aniket Joshi Justin Thomas

1. Filter out character like single quote, double quote, slash, back slash, semi colon, extended character like NULL, carry return, new line

a. input from usersb. parameters from URLc. values from cookies

2. Convert all numeric values into integer before parsing into SQL statement.

Page 11: Aniket Joshi Justin Thomas

Summary• Considered top 10 web application

vulnerabilities of 2007 and 2010 by the Open Web Application Security Project

•SQLIA’s has ▫Many sources▫Many Goals▫Many Types

•Prevention should not be developer dependent

Page 12: Aniket Joshi Justin Thomas

Thank You