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.

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

to set extremely insecure challenges, presumably on <strong>the</strong> false assumption<br />

that only <strong>the</strong>y will ever be presented with <strong>the</strong>m. An example is “Do I own<br />

a boat?” In this situation, an attacker who wants to gain access can use<br />

an automated attack to iterate through a list of enumerated or common<br />

usernames, log all <strong>the</strong> password recovery challenges, and select those that<br />

appear most easily guessable. (See Chapter 14 for techniques regarding<br />

how to grab this kind of data in a scripted attack.)<br />

n As with password change functionality, <strong>application</strong> developers commonly<br />

overlook <strong>the</strong> possibility of brute-forcing <strong>the</strong> response to a password recovery<br />

challenge, even when <strong>the</strong>y block this attack on <strong>the</strong> main login page. If<br />

an <strong>application</strong> allows unrestricted attempts to answer password recovery<br />

challenges, it is highly likely to be compromised by a determined attacker.<br />

n In some <strong>application</strong>s, <strong>the</strong> recovery challenge is replaced with a simple<br />

password “hint” that is configured by users during registration. Users<br />

commonly set extremely obvious hints, perhaps even one that is identical<br />

to <strong>the</strong> password itself, on <strong>the</strong> false assumption that only <strong>the</strong>y will<br />

ever see <strong>the</strong>m. Again, an attacker with a list of common or enumerated<br />

usernames can easily capture a large number of password hints and <strong>the</strong>n<br />

start guessing.<br />

n The mechanism by which an <strong>application</strong> enables users to regain control of<br />

<strong>the</strong>ir account after correctly responding to a challenge is often vulnerable.<br />

One reasonably secure means of implementing this is to send a unique,<br />

unguessable, time-limited recovery URL to <strong>the</strong> e-mail address that <strong>the</strong><br />

user provided during registration. Visiting this URL within a few minutes<br />

enables <strong>the</strong> user to set a new password. However, o<strong>the</strong>r mechanisms for<br />

account recovery are often encountered that are insecure by design:<br />

n Some <strong>application</strong>s disclose <strong>the</strong> existing, forgotten password to <strong>the</strong> user<br />

after successful completion of a challenge, enabling an attacker to use<br />

<strong>the</strong> account indefinitely without any risk of detection by <strong>the</strong> owner.<br />

Even if <strong>the</strong> account owner subsequently changes <strong>the</strong> blown password,<br />

<strong>the</strong> attacker can simply repeat <strong>the</strong> same challenge to obtain <strong>the</strong> new<br />

password.<br />

n Some <strong>application</strong>s immediately drop <strong>the</strong> user into an au<strong>the</strong>nticated<br />

session after successful completion of a challenge, again enabling an<br />

attacker to use <strong>the</strong> account indefinitely without detection, and without<br />

ever needing to know <strong>the</strong> user’s password.<br />

n Some <strong>application</strong>s employ <strong>the</strong> mechanism of sending a unique recovery<br />

URL but send this to an e-mail address specified by <strong>the</strong> user at <strong>the</strong><br />

time <strong>the</strong> challenge is completed. This provides absolutely no enhanced<br />

security for <strong>the</strong> recovery process beyond possibly logging <strong>the</strong> e-mail<br />

address used by an attacker.

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

Saved successfully!

Ooh no, something went wrong!