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.

Exploiting the Operating System • Chapter 6 273<br />

Tools & Traps…<br />

The Need for Elevated Privileges<br />

In Chapter 4, we discussed the methods that a person can employ to elevate his<br />

privileges through <strong>SQL</strong> injection attacks. Many of the attacks that are aimed at<br />

compromising the underlying operating system require that the <strong>SQL</strong> user be running<br />

with elevated privileges. Such elevation was not necessary in the early days, when the<br />

principle of least privilege was less understood <strong>and</strong> when every application connected<br />

to the back-end database with full db-sysadmin privileges. For this reason, most automated<br />

<strong>SQL</strong> injection toolkits provide the ability to identify the current user’s privilege<br />

level as well as multiple methods for possibly elevating him from a st<strong>and</strong>ard database<br />

user to a database super user.<br />

Accessing the File System<br />

Accessing the file system of the host running the database management system (DBMS)<br />

holds several promises for the potential attacker. In some cases, this is a precursor to attacking<br />

the operating system (e.g., finding stored credentials on the machine); in other cases, it could<br />

simply be an attempt to bypass the authorization efforts of the database itself (e.g., My<strong>SQL</strong><br />

traditionally stored its database files in ASCII text on the file system, allowing a file-read<br />

attack to read database contents sans the DBMS authorization levels).<br />

Reading Files<br />

The ability to read arbitrary files on the host running the DBMS offers interesting possibilities<br />

for the imaginative attacker. The question of “what files to read?” is an old one that attackers<br />

have been asking for a long time. The answer obviously depends largely on the attacker’s<br />

objectives. In some cases the goal may be theft of documents or binaries from the host,<br />

whereas in other cases the attacker may be hoping to find credentials of some sort to further

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

Saved successfully!

Ooh no, something went wrong!