污染是一个扩展,用于检测 XSS 代码(污染字符串)。它还可以用来发现 SQL 注入漏洞、shell 注入等。
启用污染后,如果你将污染字符串(来自 $_GET、$_POST 或 $_COOKIE)传递给某些函数,污染会警告你。
示例 #1 Taint()示例
<?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);
?>
上面的示例将输出类似于以下内容
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