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.

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

multiple times with different passwords while monitoring for <strong>the</strong> differential<br />

response that indicates that an account with that username<br />

and password already exists. The attacker will have ascertained a target<br />

user’s password without making a single attempt to log in as that user.<br />

Badly designed self-registration functionality can also provide a means for<br />

username enumeration. If an <strong>application</strong> disallows duplicate usernames, an<br />

attacker may attempt to register large numbers of common usernames to identify<br />

<strong>the</strong> existing usernames that are rejected.<br />

HACK STEPS<br />

1. If self-registration is possible, attempt to register <strong>the</strong> same username<br />

twice with different passwords.<br />

2. If <strong>the</strong> <strong>application</strong> blocks <strong>the</strong> second registration attempt, you can exploit<br />

this behavior to enumerate existing usernames even if this is not possible<br />

on <strong>the</strong> main login page or elsewhere. Make multiple registration attempts<br />

with a list of common usernames to identify <strong>the</strong> already registered names<br />

that <strong>the</strong> <strong>application</strong> blocks.<br />

3. If <strong>the</strong> registration of duplicate usernames succeeds, attempt to register<br />

<strong>the</strong> same username twice with <strong>the</strong> same password, and determine <strong>the</strong><br />

<strong>application</strong>’s behavior:<br />

a. If an error message results, you can exploit this behavior to carry out a<br />

brute-force attack, even if this is not possible on <strong>the</strong> main login page.<br />

Target an enumerated or guessed username, and attempt to register<br />

this username multiple times with a list of common passwords. When<br />

<strong>the</strong> <strong>application</strong> rejects a specific password, you have probably found<br />

<strong>the</strong> existing password for <strong>the</strong> targeted account.<br />

b. If no error message results, log in using <strong>the</strong> credentials you specified,<br />

and see what happens. You may need to register several users,<br />

and modify different data held within each account, to understand<br />

whe<strong>the</strong>r this behavior can be used to gain unauthorized access to<br />

o<strong>the</strong>r users’ accounts.<br />

Predictable Usernames<br />

Some <strong>application</strong>s automatically generate account usernames according to<br />

a predictable sequence (cust5331, cust5332, and so on). When an <strong>application</strong><br />

behaves like this, an attacker who can discern <strong>the</strong> sequence can quickly arrive<br />

at a potentially exhaustive list of all valid usernames, which can be used as<br />

<strong>the</strong> basis for fur<strong>the</strong>r attacks. Unlike enumeration methods that rely on making<br />

repeated requests driven by wordlists, this means of determining usernames<br />

can be carried out nonintrusively with minimal interaction with <strong>the</strong> <strong>application</strong>.

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

Saved successfully!

Ooh no, something went wrong!