该仓库包含 nginx 1.4.0 源代码以及预编译的二进制文件(含和不含栈保护)。此外还提供了一个 Vagrantfile 以便快速搭建环境。
公告与补丁:http://mailman.nginx.org/pipermail/nginx-announce/2013/000112.html 漏洞分析文章:http://www.vnsecurity.net/research/2013/05/21/analysis-of-nginx-cve-2013-2028.html
vagrant up
vagrant ssh
sudo /vagrant/bin/nginx1
Nginx 在虚拟机内暴露于 80 端口,在宿主机上通过 8080 端口访问。
# 虚拟机内
curl 127.0.0.1
# 虚拟机外
curl 127.0.0.1:8080
sudo gdb /vagrant/bin/nginx1
gdb> set follow-fork-mode child
gdb> r
你不需要执行这些步骤来编写漏洞利用程序;这主要是为了记录。
# 克隆仓库
hg clone http://hg.nginx.org/nginx
# 查看标签
hg tags
# 切换到 1.4.0
hg up 7809529022b8
无栈保护:
./auto/configure --without-http_rewrite_module --without-http_gzip_module
vim objs/Makefile
# 在 CFLAGS 中添加 '-fno-stack-protector'
make -j4
sudo make install
带栈保护:
./auto/configure --without-http_rewrite_module --without-http_gzip_module
make -j4
sudo make install
# 网站根目录在 /usr/local/nginx/html/
sudo ./objs/nginx