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.

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

Figure 6.6 A Sample Intranet<br />

Application (with a Microsoft <strong>SQL</strong> Server Back End)<br />

Once the attacker has determined that the sname field is vulnerable to injection, he can<br />

quickly determine his running privilege level by injecting a union query to select user_name( ),<br />

user, or loginame:<br />

http://intranet/admin/staff.asp?sname=' union select NULL,NULL,NULL,loginame<br />

FROM master..sysprocesses WHERE spid = @@SPID--<br />

This results in Figure 6.7.<br />

Figure 6.7 Confirming the <strong>Injection</strong>

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

Saved successfully!

Ooh no, something went wrong!