
익스플로잇 교육 -- CVE-2013-2028: Nginx 스택 기반 버퍼 오버플로우
이 저장소는 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는 VM 내부에서는 80 포트로, 외부(호스트)에서는 8080 포트로 노출됩니다.
# Inside VM
curl 127.0.0.1
# Outside VM
curl 127.0.0.1:8080
sudo gdb /vagrant/bin/nginx1
gdb> set follow-fork-mode child
gdb> r
익스플로잇을 개발하기 위해 이 단계를 수행할 필요는 없습니다. 이는 대체로 기록용입니다.
# Clone repository
hg clone http://hg.nginx.org/nginx
# See tags
hg tags
# Checkout 1.4.0
hg up 7809529022b8
스택 쿠키 없이:
./auto/configure --without-http_rewrite_module --without-http_gzip_module
vim objs/Makefile
# Add '-fno-stack-protector' to the CFLAGS
make -j4
sudo make install
스택 쿠키 사용:
./auto/configure --without-http_rewrite_module --without-http_gzip_module
make -j4
sudo make install
# Webroot in /usr/local/nginx/html/
sudo ./objs/nginx