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.

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

TRY IT!<br />

http://mdsec.net/auth/219/<br />

http://mdsec.net/auth/224/<br />

http://mdsec.net/auth/227/<br />

http://mdsec.net/auth/229/<br />

http://mdsec.net/auth/232/<br />

http://mdsec.net/auth/236/<br />

http://mdsec.net/auth/239/<br />

http://mdsec.net/auth/245/<br />

User Impersonation Functionality<br />

Some <strong>application</strong>s implement <strong>the</strong> facility for a privileged user of <strong>the</strong> <strong>application</strong><br />

to impersonate o<strong>the</strong>r users in order to access data and carry out actions within<br />

<strong>the</strong>ir user context. For example, some banking <strong>application</strong>s allow helpdesk operators<br />

to verbally au<strong>the</strong>nticate a telephone user and <strong>the</strong>n switch <strong>the</strong>ir <strong>application</strong><br />

session into that user’s context to assist him or her.<br />

Various design flaws commonly exist within impersonation functionality:<br />

n It may be implemented as a “hidden” function, which is not subject to<br />

proper access controls. For example, anyone who knows or guesses <strong>the</strong><br />

URL /admin/ImpersonateUser.jsp may be able to make use of <strong>the</strong> function<br />

and impersonate any o<strong>the</strong>r user (see Chapter 8).<br />

n The <strong>application</strong> may trust user-controllable data when determining whe<strong>the</strong>r<br />

<strong>the</strong> user is performing impersonation. For example, in addition to a valid<br />

session token, a user may submit a cookie specifying which account his<br />

session is currently using. An attacker may be able to modify this value<br />

and gain access to o<strong>the</strong>r user accounts without au<strong>the</strong>ntication, as shown<br />

in Figure 6-7.<br />

n If an <strong>application</strong> allows administrative users to be impersonated, any weakness<br />

in <strong>the</strong> impersonation logic may result in a vertical privilege escalation<br />

vulnerability. Ra<strong>the</strong>r than simply gaining access to o<strong>the</strong>r ordinary users’<br />

data, an attacker may gain full control of <strong>the</strong> <strong>application</strong>.<br />

n Some impersonation functionality is implemented as a simple “backdoor”<br />

password that can be submitted to <strong>the</strong> standard login page along with any<br />

username to au<strong>the</strong>nticate as that user. This design is highly insecure for<br />

many reasons, but <strong>the</strong> biggest opportunity for attackers is that <strong>the</strong>y are<br />

likely to discover this password when performing standard attacks such<br />

as brute-forcing of <strong>the</strong> login. If <strong>the</strong> backdoor password is matched before<br />

<strong>the</strong> user’s actual password, <strong>the</strong> attacker is likely to discover <strong>the</strong> function of

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

Saved successfully!

Ooh no, something went wrong!