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.

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

frequently contain security vulnerabilities — in particular, various logic flaws<br />

(see Chapter 11).<br />

COMMON MYTH<br />

It is often assumed that multistage login mechanisms are less prone to security<br />

bypasses than standard username/password au<strong>the</strong>ntication. This belief<br />

is mistaken. Performing several au<strong>the</strong>ntication checks may add considerable<br />

security to <strong>the</strong> mechanism. But counterbalancing this, <strong>the</strong> process is more<br />

prone to flaws in implementation. In several cases where a combination of<br />

flaws is present, it can even result in a solution that is less secure than a normal<br />

login based on username and password.<br />

Some implementations of multistage login mechanisms make potentially<br />

unsafe assumptions at each stage about <strong>the</strong> user’s interaction with earlier stages:<br />

n An <strong>application</strong> may assume that a user who accesses stage three must<br />

have cleared stages one and two. Therefore, it may au<strong>the</strong>nticate an attacker<br />

who proceeds directly from stage one to stage three and correctly completes<br />

it, enabling an attacker to log in with only one part of <strong>the</strong> various<br />

credentials normally required.<br />

n An <strong>application</strong> may trust some of <strong>the</strong> data being processed at stage two<br />

because this was validated at stage one. However, an attacker may be able<br />

to manipulate this data at stage two, giving it a different value than was<br />

validated at stage one. For example, at stage one <strong>the</strong> <strong>application</strong> might<br />

determine whe<strong>the</strong>r <strong>the</strong> user’s account has expired, is locked out, or is in<br />

<strong>the</strong> administrative group, or whe<strong>the</strong>r it needs to complete fur<strong>the</strong>r stages<br />

of <strong>the</strong> login beyond stage two. If an attacker can interfere with <strong>the</strong>se<br />

flags as <strong>the</strong> login transitions between different stages, he may be able to<br />

modify <strong>the</strong> <strong>application</strong>’s behavior and cause it to au<strong>the</strong>nticate him with<br />

only partial credentials or o<strong>the</strong>rwise elevate privileges.<br />

n An <strong>application</strong> may assume that <strong>the</strong> same user identity is used to complete<br />

each stage; however, it might not explicitly check this. For example, stage<br />

one might involve submitting a valid username and password, and stage<br />

two might involve resubmitting <strong>the</strong> username (now in a hidden form<br />

field) and a value from a changing physical token. If an attacker submits<br />

valid data pairs at each stage, but for different users, <strong>the</strong> <strong>application</strong> might<br />

au<strong>the</strong>nticate <strong>the</strong> user as ei<strong>the</strong>r one of <strong>the</strong> identities used in <strong>the</strong> two stages.<br />

This would enable an attacker who possesses his own physical token and<br />

discovers ano<strong>the</strong>r user’s password to log in as that user (or vice versa).<br />

Although <strong>the</strong> login mechanism cannot be completely compromised without<br />

any prior information, its overall security posture is substantially<br />

weakened, and <strong>the</strong> substantial expense and effort of implementing <strong>the</strong><br />

two-factor mechanism do not deliver <strong>the</strong> benefits expected.

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

Saved successfully!

Ooh no, something went wrong!