Taint-0.3.0(A XSS codes sniffer) released

什么是Taint? An extension used for detecting XSS codes(tainted string), And also can be used to spot sql injection vulnerabilities, shell inject, etc. 经过我实际测试, Taint-0.3.0能检测出实际的一些开源产品的(别问是什么)隐藏的XSS code, SQL注入, Shell注入等漏洞, 并且这些漏洞如果要用静态分析工具去排查, 将会非常困难, 比如对于如下的例子: $name = $_GET["name"]; $value = strval($_GET["tainted"]); echo $$name; 对于请求: http://****.com/?name=value&tainted=xxx 静态分析工具, 往往无能为力, 而Taint却可以准确无误的爆出这类型问题. Warning: main() [function.echo]: Attempt to echo a string that might be tainted in %s.php on line %d 现在0.3.0已经发布, 我想短时间内, 我不会再添加新功能了. enjoy, PHP Taint. 另外, 多说一句, Taint可以说是, 我完成的扩展中最为复杂的一个, 使用了各种tricky技巧, 大家如果有兴趣做扩展开发, 可以用来作为一个很好的高级教材. 附录: A. Tainted String 所有来自$_GET, $_POST, $_COOKIE的变量, 都被认为是Tainted String B. taint检测的函数/语句列表, 当这些函数使用tainted string参数的时候, taint会给出警告: ##### 输出函数/语句系列 echo print printf file_put_contents ##### 文件系统函数 fopen opendir basename dirname file pathinfo ##### 数据库系列函数/方法 mysql_query mysqli_query sqlite_query sqlite_single_query oci_parse Mysqli::query SqliteDataBase::query SqliteDataBase::SingleQuery PDO::query PDO::prepare ##### 命令行系列 system exec proc_open passthru shell_exec ##### 语法结构 eval include(_once) require(_once) 消除tainted信息的函数, 调用这些函数以后, tainted string就会变成合法的string: escapeshellcmd htmlspecialchars escapeshellcmd addcslashes addslashes mysqli_escape_string mysql_real_escape_string mysql_escape_string sqlite_escape_string PDO::quote Mysqli::escape_string Mysql::real_escape_string 调用中保持tainted信息的函数/语句, 调用这些函数/语句时, 如果输入是tainted string, 则输出也为tainted string: = (assign) . (concat) "{$var}" (variable substitution) .= (assign concat) strval explode implode sprintf vsprintf trim(as of 0.4.0) rtrim(as of 0.4.0) ltrim(as of 0.4.0)
联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2022

备案号:京ICP备15003423号-3