本篇文章给大家带来的内容是关于PHP的扩展Taint如何寻找网站的潜在安全漏洞,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
一、背景
笔者从接触计算机后就对网络安全一直比较感兴趣,在做PHP开发后对WEB安全一直比较关注,2016时无意中发现Taint这个扩展,体验之后发现确实好用;不过当时在查询相关资料时候发现关注此扩展的人数并不多;最近因为换了台电脑,需要再次安装了此扩展,发现这个扩展用的人还是比较少,于是笔者将安装的过程与测试结果记录下来,方便后续使用同时也让更多开发者来了解taint
二、操作概要
-
源码下载与编译
-
扩展配置与安装
-
功能检验与测试
三、源码下载与编译
Taint扩展PHP本身并不携带,在linux或mac系统当中笔者需要下载源码自己去编译安装
3.1 源码下载
笔者的开发环境是mac系统,所以需要去PHP的pecl扩展网站去下载源码,其中taint的地址为:
https://pecl.php.net/package/taint
在扩展网址的的尾部,可以看到有一排下载地址,如下图
笔者需要选择一个自己合适的版本,笔者的开发环境使用的是PHP7.1,因此选择了最新的版本,对应下载地址如下:
https://pecl.php.net/get/taint-2.0.4.tgz
使用wget下载该源码,参考命令如下:
wget https://pecl.php.net/get/taint-2.0.4.tgz
下载下来之后,笔者需要解压,解压命令参考如下:
tar -zxvf taint-2.0.4.tgz
解压之后,进入目录,参考命令如下:
cd taint-2.0.4
3.2 源码编译
现在笔者需要编译一下源码,在编译之前可以使用phpze来探测PHP的环境,参考命令如下:
phpize
返回结果如下
Configuring for:PHP Api Version: 20160303Zend Module Api No: 20160303Zend Extension Api No: 320160303
生成 Makefile,为下一步的编译做准备
./configure
返回结果
checking how to hardcode library paths into programs... immediatechecking whether stripping libraries is possible... yeschecking if libtool supports shared libraries... yeschecking whether to build shared libraries... yeschecking whether to build static libraries... nocreating libtoolappending configuration tag "CXX" to libtoolconfigure: creating ./config.statusconfig.status: creating config.h
开始编译,并安装
make && make install
(cd .libs && rm -f taint.la && ln -s ../taint.la taint.la)/bin/sh /Users/song/taint-2.0.4/libtool --mode=install cp ./taint.la /Users/song/taint-2.0.4/modulescp ./.libs/taint.so /Users/song/taint-2.0.4/modules/taint.socp ./.libs/taint.lai /Users/song/taint-2.0.4/modules/taint.la----------------<span style="color:transparent">~来1源gaodai#ma#com搞*代#码1网</span><abbr>搞代gaodaima码</abbr>------------------------------------------------------Libraries have been installed in: /Users/song/taint-2.0.4/modulesIf you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR'flag during linking and do at least one of the following: - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable during executionSee any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------Build complete.Don't forget to run 'make test'.Installing shared extensions: /usr/local/Cellar/php71/7.1.14_25/lib/php/extensions/no-debug-non-zts-20160303/