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.

588 Chapter 14 n Automating Customized Attacks<br />

n ../../../../../etc/passwd — This string causes a different response<br />

in some cases where a path traversal flaw exists.<br />

n xsstest — If this string is copied into <strong>the</strong> server’s response, <strong>the</strong> <strong>application</strong><br />

may be vulnerable to cross-site scripting.<br />

We can extend <strong>the</strong> JAttack tool to generate <strong>the</strong>se payloads by creating a new<br />

payload source:<br />

class PSFuzzStrings implements PayloadSource<br />

{<br />

static final String[] fuzzStrings = new String[]<br />

{<br />

“’”, “;/bin/ls”, “../../../../../etc/passwd”, “xsstest”<br />

};<br />

int current = -1;<br />

public boolean nextPayload()<br />

{<br />

current++;<br />

return current < fuzzStrings.length;<br />

}<br />

public void reset()<br />

{<br />

current = -1;<br />

}<br />

}<br />

public String getPayload()<br />

{<br />

return fuzzStrings[current];<br />

}<br />

NOTE Any serious attack to probe <strong>the</strong> <strong>application</strong> for security flaws would<br />

need to employ many o<strong>the</strong>r attack strings to identify o<strong>the</strong>r weaknesses and<br />

o<strong>the</strong>r variations on <strong>the</strong> defects previously mentioned. See Chapter 21 for a<br />

more comprehensive list of <strong>the</strong> strings that are effective when fuzzing a <strong>web</strong><br />

<strong>application</strong>.<br />

To use JAttack for fuzzing, we also need to extend its response analysis code<br />

to provide more information about each response received from <strong>the</strong> <strong>application</strong>.<br />

A simple way to greatly enhance this analysis is to search each response<br />

for a number of common strings and error messages that may indicate that<br />

some anomalous behavior has occurred, and record any appearance within<br />

<strong>the</strong> tool’s output.

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

Saved successfully!

Ooh no, something went wrong!