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.

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

Although it is a necessary part of an effective au<strong>the</strong>ntication mechanism,<br />

password change functionality is often vulnerable by design. Vulnerabilities<br />

that are deliberately avoided in <strong>the</strong> main login function often reappear in <strong>the</strong><br />

password change function. Many <strong>web</strong> <strong>application</strong>s’ password change functions<br />

are accessible without au<strong>the</strong>ntication and do <strong>the</strong> following:<br />

n Provide a verbose error message indicating whe<strong>the</strong>r <strong>the</strong> requested username<br />

is valid.<br />

n Allow unrestricted guesses of <strong>the</strong> “existing password” field.<br />

n Check whe<strong>the</strong>r <strong>the</strong> “new password” and “confirm new password” fields<br />

have <strong>the</strong> same value only after validating <strong>the</strong> existing password, <strong>the</strong>reby<br />

allowing an attack to succeed in discovering <strong>the</strong> existing password<br />

noninvasively.<br />

A typical password change function includes a relatively large logical decision<br />

tree. The <strong>application</strong> needs to identify <strong>the</strong> user, validate <strong>the</strong> supplied existing<br />

password, integrate with any account lockout defenses, compare <strong>the</strong> supplied<br />

new passwords with each o<strong>the</strong>r and against password quality rules, and feed<br />

back any error conditions to <strong>the</strong> user in a suitable way. Because of this, password<br />

change functions often contain subtle logic flaws that can be exploited to<br />

subvert <strong>the</strong> entire mechanism.<br />

HACK STEPS<br />

1. Identify any password change functionality within <strong>the</strong> <strong>application</strong>. If<br />

this is not explicitly linked from published content, it may still be implemented.<br />

Chapter 4 describes various techniques for discovering hidden<br />

content within an <strong>application</strong>.<br />

2. Make various requests to <strong>the</strong> password change function using invalid<br />

usernames, invalid existing passwords, and mismatched “new password”<br />

and “confirm new password” values.<br />

3. Try to identify any behavior that can be used for username enumeration<br />

or brute-force attacks (as described in <strong>the</strong> “Brute-Forcible Login” and<br />

“Verbose Failure Messages” sections).<br />

TIP If <strong>the</strong> password change form is accessible only by au<strong>the</strong>nticated users<br />

and does not contain a username field, it may still be possible to supply an<br />

arbitrary username. The form may store <strong>the</strong> username in a hidden field, which<br />

can easily be modified. If not, try supplying an additional parameter containing<br />

<strong>the</strong> username, using <strong>the</strong> same parameter name as is used in <strong>the</strong> main<br />

login form. This trick sometimes succeeds in overriding <strong>the</strong> username of <strong>the</strong><br />

current user, enabling you to brute-force <strong>the</strong> credentials of o<strong>the</strong>r users even<br />

when this is not possible at <strong>the</strong> main login.

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

Saved successfully!

Ooh no, something went wrong!