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 5 n Bypassing Client-Side Controls 145<br />

import if.if.if.if.else;<br />

import java.awt.event.KeyEvent;<br />

public class double extends public implements strict<br />

{<br />

public double(j j1)<br />

{<br />

_mthif();<br />

_fldif = j1;<br />

}<br />

private void _mthif(ActionEvent actionevent)<br />

{<br />

_mthif(((KeyEvent) (null)));<br />

switch(_fldif._mthnew()._fldif)<br />

{<br />

case 0:<br />

_fldfloat.setEnabled(false);<br />

_fldboolean.setEnabled(false);<br />

_fldinstanceof.setEnabled(false);<br />

_fldint.setEnabled(false);<br />

break;<br />

...<br />

The obfuscation techniques commonly employed are as follows:<br />

n Meaningful class, method, and member variable names are replaced<br />

with meaningless expressions such as a, b, and c. This forces <strong>the</strong> reader<br />

of decompiled code to identify <strong>the</strong> purpose of each item by studying how<br />

it is used. This can make it difficult to keep track of different items while<br />

tracing <strong>the</strong>m through <strong>the</strong> source code.<br />

n Going fur<strong>the</strong>r, some obfuscators replace item names with keywords<br />

reserved for <strong>the</strong> language, such as new and int. Although this technically<br />

renders <strong>the</strong> bytecode illegal, most virtual machines (VMs) tolerate <strong>the</strong><br />

illegal code, and it executes normally. However, even if a decompiler<br />

can handle <strong>the</strong> illegal bytecode, <strong>the</strong> resulting source code is even less<br />

readable than that just described. More importantly, <strong>the</strong> source cannot<br />

be recompiled without extensive reworking to consistently rename<br />

illegally named items.<br />

n Many obfuscators strip unnecessary debug and meta-information from<br />

<strong>the</strong> bytecode, including source filenames and line numbers (which makes<br />

stack traces less informative), local variable names (which frustrates debugging),<br />

and inner class information (which stops reflection from working<br />

properly).<br />

n Redundant code may be added that creates and manipulates various kinds<br />

of data in significant-looking ways but that is autonomous from <strong>the</strong> real<br />

data actually being used by <strong>the</strong> <strong>application</strong>’s functionality.

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

Saved successfully!

Ooh no, something went wrong!