A Taint Mode for Python via a Library
Paper i proceeding, 2010
Vulnerabilities in web applications present threats to on-line systems.
SQL injection and cross-site scripting attacks are among the most common threats
found nowadays. These attacks are often result of improper or none input validation.
To help discover such vulnerabilities, taint analyses have been developed in
popular web scripting languages like Perl, Ruby, PHP, and Python. Such analysis
are often implemented as an execution monitor, where the interpreter needs to
be adapted to provide a taint mode. However, modifying interpreters might be a
major task in its own right. In fact, it is very probably that new releases of interpreters
require to be adapted to provide a taint mode. Differently from previous
approaches, we show how to provide a taint analysis for Python via a library written
entirely in Python, and thus avoiding modifications in the interpreter. The concepts
of classes, decorators and dynamic dispatch makes our solution lightweight,
easy to use, and particularly neat. With minimal or none effort, the library can be
adapted to work with different Python interpreters.