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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Blind <strong>SQL</strong> <strong>Injection</strong><br />

Functions: Microsoft <strong>SQL</strong> Server<br />

References • Chapter 10 427<br />

Table 10.9 lists functions that are useful when performing blind <strong>SQL</strong> injection attacks.<br />

Table 10.9 Blind <strong>SQL</strong> <strong>Injection</strong> Functions<br />

Data<br />

String length<br />

Extract substring from a given string<br />

String (‘ABC’) representation with<br />

no single quotes<br />

Trigger time delay<br />

Query<br />

LEN()<br />

SUBSTRING(string,offset,length)<br />

SELECT char(0x41) + char(0x42) +<br />

char(0x43);<br />

WAITFOR DELAY '0:0:9';-- triggers<br />

9 second time delay<br />

IF statement IF (1=1) SELECT 'A' ELSE SELECT 'B' --<br />

returns 'A'<br />

Microsoft <strong>SQL</strong> Server Privilege Escalation<br />

This section covers some of the generic privilege escalation attacks that can be performed<br />

against the Microsoft <strong>SQL</strong> Server platform. Over the years, a number of vulnerabilities have<br />

been discovered <strong>and</strong> publicly disclosed that could be used to elevate privileges. However,<br />

since Microsoft regularly patches vulnerabilities within the database platform, any list<br />

produced here would be out of date by the time this book is published. To learn more about<br />

the most recent vulnerabilities affecting the Microsoft <strong>SQL</strong> Server platform, search a popular<br />

vulnerability database such as www.secunia.com or www.securityfocus.com. Table 10.10<br />

maps the version number stored within the @@version variable to an actual release <strong>and</strong><br />

service pack number. See the following Microsoft Knowledge base article for further details:<br />

http://support.microsoft.com/kb/937137/en-us.<br />

Table 10.10 Microsoft <strong>SQL</strong> Server Version Numbers<br />

Version Number<br />

Service Pack<br />

9.00.3042 Microsoft <strong>SQL</strong> Server 2005 SP2<br />

9.00.2047 Microsoft <strong>SQL</strong> Server 2005 SP1<br />

9.00.1399 Microsoft <strong>SQL</strong> Server 2005<br />

Continued

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

Saved successfully!

Ooh no, something went wrong!