19.09.2017 Views

the-web-application-hackers-handbook

Create successful ePaper yourself

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

Chapter 6 n Attacking Au<strong>the</strong>ntication 167<br />

are <strong>the</strong> password change and forgotten password functions, as described later<br />

in this chapter.<br />

NOTE Many au<strong>the</strong>ntication mechanisms disclose usernames ei<strong>the</strong>r implicitly<br />

or explicitly. In a <strong>web</strong> mail account, <strong>the</strong> username is often <strong>the</strong> e-mail<br />

address, which is common knowledge by design. Many o<strong>the</strong>r sites expose<br />

usernames within <strong>the</strong> <strong>application</strong> without considering <strong>the</strong> advantage this<br />

grants to an attacker, or generate usernames in a way that can be predicted<br />

(for example, user1842, user1843, and so on).<br />

In more complex login mechanisms, where an <strong>application</strong> requires <strong>the</strong> user to<br />

submit several pieces of information, or proceed through several stages, verbose<br />

failure messages or o<strong>the</strong>r discriminators can enable an attacker to target each<br />

stage of <strong>the</strong> login process in turn, increasing <strong>the</strong> likelihood that he will gain<br />

unauthorized access.<br />

NOTE This vulnerability may arise in more subtle ways than illustrated here.<br />

Even if <strong>the</strong> error messages returned in response to a valid and invalid username<br />

are superficially similar, <strong>the</strong>re may be small differences between <strong>the</strong>m that can<br />

be used to enumerate valid usernames. For example, if multiple code paths<br />

within <strong>the</strong> <strong>application</strong> return <strong>the</strong> “same” failure message, <strong>the</strong>re may be minor<br />

typographical differences between each instance of <strong>the</strong> message. In some cases,<br />

<strong>the</strong> <strong>application</strong>’s responses may be identical on-screen but contain subtle differences<br />

hidden within <strong>the</strong> HTML source, such as comments or layout differences. If<br />

no obvious means of enumerating usernames presents itself, you should perform<br />

a close comparison of <strong>the</strong> <strong>application</strong>’s responses to valid and invalid usernames.<br />

You can use <strong>the</strong> Comparer tool within Burp Suite to automatically analyze<br />

and highlight <strong>the</strong> differences between two <strong>application</strong> responses, as shown<br />

in Figure 6-4. This helps you quickly identify whe<strong>the</strong>r <strong>the</strong> username’s validity<br />

results in any systematic difference in <strong>the</strong> <strong>application</strong>’s responses.<br />

Figure 6-4: Identifying subtle differences in <strong>application</strong> responses using Burp Comparer

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

Saved successfully!

Ooh no, something went wrong!