PHP Taint

Taint扩展安装与使用
本文介绍了Taint扩展在PHP开发环境中的作用及其在Windows和Linux平台上的安装步骤。Taint扩展能帮助开发者检测XSS攻击、SQL注入等安全威胁,并提供了多个安全函数来保护应用程序。

Taint扩展PHP开发环境中用于检测XSS代码(污染的字符串),SQL注入漏洞,shell注入,等。目前支持PHP 7.1。Windows平台下提供线程安全和非线程安全两个版本,各支持64位和32位。本文选择非线程安全

 

Windows平台

下载非线程安全版本

wget  http://windows.php.net/downloads/pecl/releases/taint/2.0.2/php_taint-2.0.2-7.0-nts-vc14-x86.zip

安装php_taint.dll文件到下述目录下 

...\php\ext

修改php.ini配置文件

display_errors = On
error_reporting = E_ALL & ~E_DEPRECATED

extension=php_taint.dll
taint.enable=1

重启web、php服务器,查看phpinfo(),检查模块是否安装上。

 

Linux平台

下载安装taint

wget http://pecl.php.net/get/taint-2.0.2.tgz

tar zxvf taint-2.0.2.tgz 

cd taint-2.0.2
phpize(如果找不到该命令,需要apt-get install php7-dev)
./configure
make
make install

修改php.ini配置文件

display_errors = On
error_reporting = E_ALL & ~E_DEPRECATED

extension=taint.so
taint.enable=1

 

日常开发运行过程中的请重点检查Warning部分 Tainted提示信息

 

安全函数

addslashes    
addcslashes    
htmlspecialchars    
htmlentities    
escapeshellcmd    
mysql_escape_string    
mysql_real_escape_string    
mysqli_escape_string/MySQLi::escape_string    
mysqli_real_escape_string/MySQLi::real_escape_string    
sqlite_escape_string/SqliteDataBase::escapeString    
PDO::quote

 

 

参考:

http://php.net/manual/en/book.taint.php
http://www.cnblogs.com/k1988/archive/2011/01/26/2165616.html
https://blog.ianli.site/2013/09/build-php-and-extension-for-windows

转载于:https://www.cnblogs.com/superf0sh/p/5703055.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值