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.

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

(Integer.toHexString((byte)s1.charAt((j * 19 + 7) % s1.length()) ^<br />

s2.charAt(j))).toString();<br />

int k = s3.length();<br />

if(k > 2)<br />

s3 = s3.substring(k - 2, k);<br />

stringbuilder.append(s3);<br />

}<br />

return stringbuilder.toString();<br />

}<br />

}<br />

This version of <strong>the</strong> modified component provides a valid obfuscated string<br />

for <strong>the</strong> arbitrary quantity of 999. Note that you could use nonnumeric input<br />

here, allowing you to probe <strong>the</strong> <strong>application</strong> for various kinds of input-based<br />

vulnerabilities.<br />

TIP The Jad program saves its decompiled source code with <strong>the</strong> .jad extension.<br />

However, if you want to modify and recompile <strong>the</strong> source code, you need<br />

to rename each source file with <strong>the</strong> .java extension.<br />

All that remains is to recompile <strong>the</strong> source code using <strong>the</strong> javac compiler<br />

that comes with <strong>the</strong> Java SDK, and <strong>the</strong>n execute <strong>the</strong> component from <strong>the</strong><br />

command line:<br />

C:\tmp>javac CheckQuantity.java<br />

C:\tmp>java CheckQuantity<br />

4b282c510f776a455d425a7808015c555f42585460464d1e42684c414a152b1e0b5a520a<br />

145911171609<br />

Our modified component has now performed <strong>the</strong> necessary obfuscation<br />

on our arbitrary quantity of 999. To deliver <strong>the</strong> attack to <strong>the</strong> server, we simply<br />

need to submit <strong>the</strong> order form in <strong>the</strong> normal way using valid input, intercept<br />

<strong>the</strong> resulting request using our proxy, and substitute <strong>the</strong> obfuscated quantity<br />

with <strong>the</strong> one provided by our modified component. Note that if <strong>the</strong> <strong>application</strong><br />

issues a new obfuscation pad each time <strong>the</strong> order form is loaded, you need to<br />

ensure that <strong>the</strong> obfuscation pad being submitted back to <strong>the</strong> server matches <strong>the</strong><br />

one that was used to obfuscate <strong>the</strong> quantity also being submitted.<br />

TRY IT!<br />

These examples demonstrate <strong>the</strong> attack just described and <strong>the</strong> corresponding<br />

attacks using Silverlight and Flash technologies:<br />

http://mdsec.net/shop/154/<br />

http://mdsec.net/shop/167/<br />

http://mdsec.net/shop/179/

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

Saved successfully!

Ooh no, something went wrong!