29.11.2012 Views

2nd USENIX Conference on Web Application Development ...

2nd USENIX Conference on Web Application Development ...

2nd USENIX Conference on Web Application Development ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Abstract<br />

Ioannis Papagiannis<br />

Imperial College L<strong>on</strong>d<strong>on</strong><br />

PHP Aspis: Using Partial Taint Tracking<br />

To Protect Against Injecti<strong>on</strong> Attacks<br />

<strong>Web</strong> applicati<strong>on</strong>s are increasingly popular victims of security<br />

attacks. Injecti<strong>on</strong> attacks, such as Cross Site<br />

Scripting or SQL Injecti<strong>on</strong>, are a persistent problem.<br />

Even though developers are aware of them, the suggested<br />

best practices for protecti<strong>on</strong> are error pr<strong>on</strong>e: unless all<br />

user input is c<strong>on</strong>sistently filtered, any applicati<strong>on</strong> may be<br />

vulnerable. When hosting web applicati<strong>on</strong>s, administrators<br />

face a dilemma: they can <strong>on</strong>ly deploy applicati<strong>on</strong>s<br />

that are trusted or they risk their system’s security.<br />

To prevent injecti<strong>on</strong> vulnerabilities, we introduce<br />

PHP Aspis: a source code transformati<strong>on</strong> tool that applies<br />

partial taint tracking at the language level. PHP Aspis<br />

augments values with taint meta-data to track their<br />

origin in order to detect injecti<strong>on</strong> vulnerabilities. To improve<br />

performance, PHP Aspis carries out taint propagati<strong>on</strong><br />

<strong>on</strong>ly in an applicati<strong>on</strong>’s most vulnerable parts: thirdparty<br />

plugins. We evaluate PHP Aspis with Wordpress,<br />

a popular open source weblog platform, and show that<br />

it prevents all code injecti<strong>on</strong> exploits that were found in<br />

Wordpress plugins in 2010.<br />

1 Introducti<strong>on</strong><br />

The most comm<strong>on</strong> types of web applicati<strong>on</strong> attacks involve<br />

code injecti<strong>on</strong> [4]: Javascript that is embedded into<br />

the generated HTML (Cross Site Scripting, or XSS), SQL<br />

that is part of a generated database query (SQL Injecti<strong>on</strong>,<br />

or SQLI) or scripts that are executed <strong>on</strong> the web server<br />

(Shell Injecti<strong>on</strong> and Eval Injecti<strong>on</strong>). These attacks comm<strong>on</strong>ly<br />

exploit the web applicati<strong>on</strong>’s trust in user-provided<br />

data. If user-provided data are not properly filtered and<br />

sanitised before use, an attacker can trick the applicati<strong>on</strong><br />

into generating arbitrary HMTL resp<strong>on</strong>ses and SQL<br />

queries, or even execute user-supplied, malicious code.<br />

Even though web developers are generally aware of<br />

code injecti<strong>on</strong> vulnerabilities, applicati<strong>on</strong>s c<strong>on</strong>tinue to<br />

suffer from relevant exploits. In 2010, 23.9% of the total<br />

reported vulnerabilities to the CVE database were classi-<br />

Matteo Migliavacca<br />

Imperial College L<strong>on</strong>d<strong>on</strong><br />

1<br />

Peter Pietzuch<br />

Imperial College L<strong>on</strong>d<strong>on</strong><br />

fied as SQLI or XSS [12]. Morover, injecti<strong>on</strong> vulnerabilities<br />

are often comm<strong>on</strong> in third-party plugins instead of<br />

the well-tested core of a web applicati<strong>on</strong>: in 2010, 10 out<br />

of 12 reported Wordpress injecti<strong>on</strong> exploits in the CVE<br />

database involved plugins and not Wordpress itself.<br />

Such vulnerabilities still remain because suggested soluti<strong>on</strong>s<br />

often require manual tracking and filtering of<br />

user-generated data throughout the source code of an applicati<strong>on</strong>.<br />

Yet, even a single unprotected input channel<br />

in an applicati<strong>on</strong> is enough to cause an injecti<strong>on</strong><br />

vulnerability. Thus, less experienced and therefore less<br />

security-c<strong>on</strong>scious developers of third-party plugins are<br />

more likely to write vulnerable code.<br />

Past research has suggested runtime taint tracking [19,<br />

18, 14] as an effective soluti<strong>on</strong> to prevent injecti<strong>on</strong> exploits.<br />

In this approach, the origin of all data within<br />

the applicati<strong>on</strong> is tracked by associating meta-data with<br />

strings. When an applicati<strong>on</strong> executes a sensitive operati<strong>on</strong>,<br />

such as outputting HTML, these meta-data are used<br />

to escape potentially dangerous values. The most efficient<br />

implementati<strong>on</strong> of taint tracking is within the language<br />

runtime. Runtime taint tracking is not widely used<br />

in PHP, however, because it relies <strong>on</strong> custom runtimes<br />

that are not available in producti<strong>on</strong> envir<strong>on</strong>ments. Thus,<br />

developers are forced to avoid vulnerabilities manually.<br />

We show that injecti<strong>on</strong> vulnerabilities in PHP can be<br />

addressed by applying taint tracking entirely at the source<br />

code level without modificati<strong>on</strong>s to the PHP language<br />

runtime. To reduce the incurred performance overhead<br />

due to extensive source code rewriting, we introduce partial<br />

taint tracking, which limits taint tracking <strong>on</strong>ly to<br />

functi<strong>on</strong>s of the web applicati<strong>on</strong> in which vulnerabilities<br />

are more likely to occur. Partial taint tracking effectively<br />

captures the different levels of trust placed into different<br />

parts of web applicati<strong>on</strong>s. It offers better performance<br />

because parts of the applicati<strong>on</strong> code remain unchanged.<br />

We dem<strong>on</strong>strate this approach using PHP Aspis 1 ,a<br />

1An Aspis was the circular wooden shield carried by soldiers in ancient<br />

Greece.<br />

<str<strong>on</strong>g>USENIX</str<strong>on</strong>g> Associati<strong>on</strong> <strong>Web</strong>Apps ’11: <str<strong>on</strong>g>2nd</str<strong>on</strong>g> <str<strong>on</strong>g>USENIX</str<strong>on</strong>g> <str<strong>on</strong>g>C<strong>on</strong>ference</str<strong>on</strong>g> <strong>on</strong> <strong>Web</strong> Applicati<strong>on</strong> <strong>Development</strong> 13

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

Saved successfully!

Ooh no, something went wrong!