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.

652 Chapter 17 n Attacking Application Architecture<br />

Figure 17-2: An attack that undercuts <strong>the</strong> database tier to retrieve arbitrary data<br />

TIP If an attacker has file-write access, he can try to write to <strong>the</strong> <strong>application</strong>’s<br />

configuration, or write to a hosted virtual directory to get command<br />

execution. See <strong>the</strong> nslookup example in Chapter 10.<br />

Using Local File Inclusion to Execute Commands<br />

Most languages contain a function that allows a local file to be included within<br />

<strong>the</strong> current script. The ability for an attacker to specify any file on <strong>the</strong> filesystem<br />

is undeniably a high-risk issue. Such a file could be <strong>the</strong> /etc/passwd file or a<br />

configuration file containing a password. In <strong>the</strong>se cases <strong>the</strong> risk of information<br />

disclosure is obvious, but <strong>the</strong> attacker cannot necessarily escalate <strong>the</strong> attack to<br />

fur<strong>the</strong>r compromise <strong>the</strong> system (unlike with remote file inclusion, as described<br />

in Chapter 10). However, it may still be possible for an attacker to execute commands<br />

by including a file whose contents he partially controls, as a result of<br />

o<strong>the</strong>r <strong>application</strong> or platform features.<br />

Consider an <strong>application</strong> that takes user input within <strong>the</strong> country parameter<br />

in <strong>the</strong> following URL:<br />

http://eis/mdsecportal/prefs/preference_2?country=en-gb

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

Saved successfully!

Ooh no, something went wrong!