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<br />

19<br />

Finding Vulnerabilities<br />

in Source Code<br />

So far, <strong>the</strong> attack techniques we have described have all involved interacting<br />

with a live running <strong>application</strong> and have largely consisted of submitting crafted<br />

input to <strong>the</strong> <strong>application</strong> and monitoring its responses. This chapter examines an<br />

entirely different approach to finding vulnerabilities — reviewing <strong>the</strong> <strong>application</strong>’s<br />

source code.<br />

In various situations it may be possible to perform a source code audit to help<br />

attack a target <strong>web</strong> <strong>application</strong>:<br />

n Some <strong>application</strong>s are open source, or use open source components,<br />

enabling you to download <strong>the</strong>ir code from <strong>the</strong> relevant repository and<br />

scour it for vulnerabilities.<br />

n If you are performing a penetration test in a consultancy context, <strong>the</strong> <strong>application</strong><br />

owner may grant you access to his or her source code to maximize<br />

<strong>the</strong> effectiveness of your audit.<br />

n You may discover a file disclosure vulnerability within an <strong>application</strong> that<br />

enables you to download its source code (ei<strong>the</strong>r partially or in its entirety).<br />

n Most <strong>application</strong>s use some client-side code such as JavaScript, which is<br />

accessible without requiring any privileged access.<br />

It is often believed that to carry out a code review, you must be an experienced<br />

programmer and have detailed knowledge of <strong>the</strong> language being used.<br />

However, this need not be <strong>the</strong> case. Many higher-level languages can be read<br />

701

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

Saved successfully!

Ooh no, something went wrong!