19.09.2017 Views

the-web-application-hackers-handbook

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

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

548 Chapter 13 n Attacking Users: O<strong>the</strong>r Techniques<br />

This functionality allows <strong>application</strong>s to store commonly used data on <strong>the</strong><br />

client side and retrieve this quickly into <strong>the</strong> user interface when required. It also<br />

allows <strong>application</strong>s to work in “offline mode,” in which all data processed by<br />

<strong>the</strong> <strong>application</strong> resides on <strong>the</strong> client, and user actions are stored on <strong>the</strong> client for<br />

later synchronization with <strong>the</strong> server, when a network connection is available.<br />

Chapter 9 described how SQL injection attacks into server-side SQL databases<br />

can arise, where attacker-controlled data is inserted into a SQL query in an<br />

unsafe way. Exactly <strong>the</strong> same attack can arise on <strong>the</strong> client side. Here are some<br />

scenarios in which this may be possible:<br />

n Social networking <strong>application</strong>s that store details of <strong>the</strong> user’s contacts in<br />

<strong>the</strong> local database, including contact names and status updates<br />

n News <strong>application</strong>s that store articles and user comments in <strong>the</strong> local<br />

database for offline viewing<br />

n Web mail <strong>application</strong>s that store e-mail messages in <strong>the</strong> local database<br />

and, when running in offline mode, store outgoing messages for later<br />

sending<br />

In <strong>the</strong>se situations, an attacker may be able to perform client-side SQL injection<br />

attacks by including crafted input in a piece of data he controls, which <strong>the</strong><br />

<strong>application</strong> stores locally. For example, sending an e-mail containing a SQL<br />

injection attack in <strong>the</strong> subject line might compromise <strong>the</strong> local database of <strong>the</strong><br />

recipient user, if this data is embedded within a client-side SQL query. Depending<br />

on exactly how <strong>the</strong> <strong>application</strong> uses <strong>the</strong> local database, serious attacks may be<br />

possible. Using only SQL injection, an attacker may be able to retrieve from <strong>the</strong><br />

database <strong>the</strong> contents of o<strong>the</strong>r messages <strong>the</strong> user has received, copy this data<br />

into a new outgoing e-mail to <strong>the</strong> attacker, and add this e-mail to <strong>the</strong> table of<br />

queued outgoing messages.<br />

The types of data that are often stored in client-side databases are likely to<br />

include SQL metacharacters such as <strong>the</strong> single quotation mark. Therefore, many<br />

SQL injection vulnerabilities are likely to be identified during normal usability<br />

testing, so defenses against SQL injection attacks may be in place. As with<br />

server-side injection, <strong>the</strong>se defenses may contain various bypasses that can be<br />

used to still deliver a successful attack.<br />

Client-Side HTTP Parameter Pollution<br />

Chapter 9 described how HTTP parameter pollution attacks can be used in some<br />

situations to interfere with server-side <strong>application</strong> logic. In some situations, <strong>the</strong>se<br />

attacks may also be possible on <strong>the</strong> client side.<br />

Suppose that a <strong>web</strong> mail <strong>application</strong> loads <strong>the</strong> inbox using <strong>the</strong> following URL:<br />

https://wahh-mail.com/show?folder=inbox&order=down&size=20&start=1

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

Saved successfully!

Ooh no, something went wrong!