PHP Conference Ehime 2026

taint 在哪里发出警告

当一个被污染的字符串到达下列汇点(sink)之一时,taint 会发出警告 (默认级别为 E_USER_WARNING;可通过 taint.error_level 配置)。只有顶层的字符串参数会被检查;只是内容中包含被污染值的数组, 在 dump 时不会触发警告。

输出类汇点
汇点检查的内容
echoprint 被 echo / print 输出的表达式
printf()vprintf() 格式串及其代入的各个值
print_r()var_dump()var_export() 被 dump 的值(当它是字符串时)
带消息的 exit/die 消息内容
写入 php://outputfile_put_contents()fwrite()fputs() 被写入的数据

文件系统类汇点
汇点检查的内容
fopen()opendir()unlink() 路径
file()readfile()file_get_contents()highlight_file()/show_source() 路径
copy()rename()move_uploaded_file() 源路径和目标路径
mkdir()rmdir()touch() 路径
includeinclude_oncerequirerequire_once 文件路径

SQL 类汇点
汇点检查的内容
mysqli_query()mysqli_prepare()mysqli_real_query()mysqli_multi_query() 查询字符串
mysql_query()sqlite_query()sqlite_single_query()oci_parse()pg_query()pg_send_query() 查询字符串
mysqli::query()mysqli::prepare()mysqli::real_query()mysqli::multi_query() 查询字符串
PDO::query()PDO::prepare()PDO::exec() 查询字符串
SQLite3::query()SQLite3::prepare()SQLite3::exec()SQLiteDatabase::query()SQLiteDatabase::singleQuery() 查询字符串

命令执行类汇点
汇点检查的内容
exec()system()passthru()shell_exec()(包括反引号运算符) 命令字符串
proc_open()popen() 命令字符串
eval 被执行的代码
动态调用,如 $func()$obj->$method()call_user_func()、数组形式的 callable 被解析的函数/方法/类名
preg_match()preg_match_all()preg_replace()preg_split()preg_grep()preg_replace_callback() pattern(以及 preg_replace_callback() 的回调名)

HTTP 头与 Cookie 类汇点
汇点检查的内容
header() header 字符串
setcookie()setrawcookie() cookie 的名称和值

其他汇点
汇点检查的内容
unserialize() 序列化字符串
mail() to、subject、additional_parameters 和 additional_headers(邮件正文属于内容,不检查)

警告的格式为 function_name() [sink]: message,其中 sink 指明被检查的操作(例如 echoinclude 或函数名), message 则描述发现的可疑污染内容。

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top