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.

142 Chapter 5 n Bypassing Client-Side Controls<br />

Working on <strong>the</strong> Source Code<br />

Having obtained <strong>the</strong> source code for <strong>the</strong> component, or something resembling<br />

it, you can take various approaches to attacking it. The first step generally is<br />

to review <strong>the</strong> source code to understand how <strong>the</strong> component works and what<br />

functionality it contains or references. Here are some items to look for:<br />

n Input validation or o<strong>the</strong>r security-relevant logic and events that occur<br />

on <strong>the</strong> client side<br />

n Obfuscation or encryption routines being used to wrap user-supplied<br />

data before it is sent to <strong>the</strong> server<br />

n “Hidden” client-side functionality that is not visible in your user interface<br />

but that you might be able to unlock by modifying <strong>the</strong> component<br />

n References to server-side functionality that you have not previously identified<br />

via your <strong>application</strong> mapping<br />

Often, reviewing <strong>the</strong> source code uncovers some interesting functions<br />

within <strong>the</strong> component that you want to modify or manipulate to identify<br />

potential security vulnerabilities. This may include removing client-side<br />

input validation, submitting nonstandard data to <strong>the</strong> server, manipulating<br />

client-side state or events, or directly invoking functionality that is present<br />

within <strong>the</strong> component.<br />

You can modify <strong>the</strong> component’s behavior in several ways, as described in<br />

<strong>the</strong> following sections.<br />

Recompiling and Executing Within <strong>the</strong> Browser<br />

You can modify <strong>the</strong> decompiled source code to change <strong>the</strong> component’s behavior,<br />

recompile it to bytecode, and execute <strong>the</strong> modified component within your<br />

browser. This approach is often preferred when you need to manipulate key<br />

client-side events, such as <strong>the</strong> rolling of dice in a gaming <strong>application</strong>.<br />

To perform <strong>the</strong> recompilation, you need to use <strong>the</strong> developer tools that are<br />

relevant to <strong>the</strong> technology you are using:<br />

n For Java, use <strong>the</strong> javac program in <strong>the</strong> JDK to recompile your modified<br />

source code.<br />

n For Flash, you can use flasm to reassemble your modified bytecode or<br />

one of <strong>the</strong> Flash development studios from Adobe to recompile modified<br />

ActionScript source code.<br />

n For Silverlight, use Visual Studio to recompile your modified source code.<br />

Having recompiled your source code into one or more bytecode files, you<br />

may need to repackage <strong>the</strong> distributable file if required for <strong>the</strong> technology<br />

being used. For Java and Silverlight, replace <strong>the</strong> modified bytecode files in your

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

Saved successfully!

Ooh no, something went wrong!