# Taint

# Introduction

Taint is an extension, which is used for detecting XSS codes (tainted string). And also can be used to spot sql injection vulnerabilities, and shell inject, etc.

When taint is enabled, if you pass a tainted string (comes from $_GET, $_POST or $_COOKIE) to some functions, taint will warn you about that.

Example #1 Taint()example

`<?php
$a = trim($_GET['a']);
$file_name = '/tmp' . $a;
$output = "Welcome, {$a} !!!";
$var = "output";
$sql = "Select * from " . $a;
$sql .= "ooxx";
echo $output;
print $$var;
include $file_name;
mysql_query($sql);
?>`

The above example will output something similar to:

    Warning: main() [function.echo]: Attempt to echo a string that might be tainted

    Warning: main() [function.echo]: Attempt to print a string that might be tainted

    Warning: include() [function.include]: File path contains data that might be tainted

    Warning: mysql_query() [function.mysql-query]: SQL statement contains data that might be tainted

- Installing/Configuring
  - Installation
  - Runtime Configuration
- More Details
  - Functions and Statements which will spread the tainted mark of a tainted string
  - Functions and statements which will check tainted string
  - Functions which untaint the tainted string
- Taint Functions
  - is_tainted — Checks whether a string is tainted
  - taint — Taint a string
  - untaint — Untaint strings

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open