PHP Conference Japan 2024

简介

污染是一个扩展,用于检测 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
添加注释

用户贡献的注释

此页面没有用户贡献的注释。
To Top