28.10.2014 Views

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

92 Chapter 2 • Testing for <strong>SQL</strong> <strong>Injection</strong><br />

vulnerability. However, blind <strong>SQL</strong> injection is something that can also be exploited,<br />

even if the application doesn’t return an obvious error.<br />

Confirming <strong>SQL</strong> <strong>Injection</strong><br />

˛˛ To confirm an <strong>SQL</strong> injection vulnerability <strong>and</strong> in prevision for later exploitation<br />

you need to craft a request that injects <strong>SQL</strong> code such that the application creates a<br />

syntactically correct <strong>SQL</strong> statement that is in turn executed by the database server<br />

without returning any errors.<br />

˛˛ When creating a syntactically correct statement you may be able to terminate it<br />

<strong>and</strong> comment out the rest of the query. In these scenarios, <strong>and</strong> provided that the<br />

back-end database supports multiple statements, you usually can chain arbitrary<br />

<strong>SQL</strong> code with no restrictions, providing you with the ability to conduct attacks<br />

such as privilege escalation.<br />

˛˛ Sometimes the application will not reply with any visual sign of the injection<br />

attempts. In such cases, you can confirm the injection by introducing a delay in the<br />

reply from the database. The application server will wait for the database to reply<br />

<strong>and</strong> you will be able to verify whether a vulnerability exists. In this scenario, you<br />

need to be aware that network <strong>and</strong> server workloads might interfere slightly with<br />

your delays.<br />

Automating <strong>SQL</strong> <strong>Injection</strong> Discovery<br />

˛˛ The processes involved in finding <strong>SQL</strong> injection vulnerabilities can be automated<br />

to a certain extent. Automation can be very beneficial when you need to test large<br />

Web sites; however, you need to be aware that automatic discovery tools may not<br />

identify some of the existing vulnerabilities. Don’t rely fully on automated tools.<br />

˛˛ Several commercial tools provide a full security assessment of a Web site, including<br />

testing for <strong>SQL</strong> injection vulnerabilities.<br />

˛˛ The free <strong>and</strong> open source tools offer a good alternative to aid you in the process of<br />

finding <strong>SQL</strong> injection vulnerabilities in large sites.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!