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.

Contents xvii<br />

Increase the Verbosity of Web Server Logs.. . . . . . . . . . . . . . . . . . . . . . . . . 409<br />

Deploy the Web <strong>and</strong> Database Servers on Separate Hosts.. . . . . . . . . . . . . . 409<br />

Configure Network Access Control. ............................. 409<br />

Summary. ................................................... 410<br />

Solutions Fast Track.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410<br />

Frequently Asked Questions.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412<br />

Chapter 10 References. ........................................ 415<br />

Introduction .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416<br />

Structured Query Language (<strong>SQL</strong>) Primer.. . . . . . . . . . . . . . . . . . . . . . . . . . . 416<br />

<strong>SQL</strong> Queries.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416<br />

SELECT Statement........................................ 417<br />

UNION Operator. ....................................... 417<br />

INSERT Statement.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418<br />

UPDATE Statement. ...................................... 418<br />

DELETE Statement........................................ 418<br />

DROP Statement .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420<br />

CREATE TABLE Statement .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420<br />

ALTER TABLE Statement................................... 420<br />

GROUP BY Statement..................................... 421<br />

ORDER BY Clause.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421<br />

Limiting the Result Set.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421<br />

<strong>SQL</strong> <strong>Injection</strong> Quick Reference. .................................. 422<br />

Identifying the Database Platform.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422<br />

Identifying the Database Platform via Time Delay Inference .. . . . . . . . . 423<br />

Identifying the Database Platform via <strong>SQL</strong> Dialect Inference.......... 423<br />

Combining Multiple Rows into a Single Row.. . . . . . . . . . . . . . . . . . . 424<br />

Microsoft <strong>SQL</strong> Server Cheat Sheet.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425<br />

Enumerating Database Configuration<br />

Information <strong>and</strong> Schema.................................. 425<br />

Blind <strong>SQL</strong> <strong>Injection</strong> Functions: Microsoft <strong>SQL</strong> Server .. . . . . . . . . . . . . 427<br />

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

OPENROWSET Reauthentication Attack..................... 428<br />

Attacking the Database Server: Microsoft <strong>SQL</strong> Server.. . . . . . . . . . . . . . 429<br />

System Comm<strong>and</strong> Execution via xp_cmdshell .. . . . . . . . . . . . . . . . . 429<br />

xp_cmdshell Alternative. ................................. 430<br />

Cracking Database Passwords............................... 430<br />

Microsoft <strong>SQL</strong> Server 2005 Hashes .. . . . . . . . . . . . . . . . . . . . . . . . . 431<br />

File Read/Write........................................ 431

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

Saved successfully!

Ooh no, something went wrong!