Deep understanding of DNS tunnel communication in practical scenarios

Deep understanding of DNS tunnel communication in practical scenarios

Preface

Recently, we conducted an in-depth analysis of the use of Domain Name System (DNS) tunneling technology in the wild and how it is used. Attackers can use DNS tunneling technology to bypass various security policies in the organizational network environment, because most organizations have relatively lax management policies for DNS traffic. Previous research has also shown that malware activities such as SUNBURST and OilRig use DNS tunneling technology to achieve remote command and control (C2).

However, there are still many details unknown about how attackers use DNS tunneling in the wild. For example, do they use DNS tunneling only for C2? How do they implement and host these technologies? Can we monitor malicious activities by capturing and monitoring DNS tunneling traffic?

In this post, we will provide a detailed analysis and introduction to multiple aspects of DNS tunneling techniques that attackers use in the wild.

DNS Tunneling Basics

What is DNS Tunneling?

DNS tunneling is a technique that encodes data for non-DNS programs and protocols in DNS queries and responses. This allows various types of traffic to be forwarded over the DNS protocol, including file transfers, C2, and web traffic.

Why perform DNS tunneling

DNS usually uses UDP port 53, which is usually opened on clients, systems, servers, and firewalls to support the transmission of DNS queries. DNS is a fundamental component of the Internet, providing services for many applications, from web browsing and email services to host automatic discovery, load balancing, security review and monitoring services, etc. DNS is required.

Due to its critical nature, most organizations have relatively lax security management policies for DNS traffic, which has led many attackers to choose to exploit the DNS protocol to tunnel C2 communication traffic and retrieve malware payloads.

Many malware campaigns, such as SUNBURST, OilRig, xHunt, and DarkHydrus, use DNS tunneling. The permissive policy of DNS traffic allows attackers to access the Internet, while a large amount of benign DNS traffic becomes a natural disguise for attackers to hide their tracks.

How to perform DNS tunneling

There are two main components required to perform DNS tunneling: a client and a server. The client sends DNS packets to the internet, encodes the content with a DNS query, and decodes the content from the DNS response. The server receives DNS queries from recursive resolvers, decodes the content from the DNS query, and encodes the content into a DNS response.

The following figure shows the execution process of DNS tunnel:

In the above diagram, the client first encodes the sensitive data value as a subdomain $secret and sends it as a DNS query request to $secret.badsite[.]com. Next, the resolver iteratively queries the name servers at different domain levels until a valid response is received. Similarly, the server component (name server) can also encode the malicious payload as a subdomain $payload and send a DNS response (CNAME $payload.bs[.]com) to $secret.badsite[.]com.

Instead of sending the raw data, we usually encode and fragment the data using a coding algorithm. In fact, anyone can come up with an algorithm to achieve data fragmentation.

There are also many readily available open source DNS tunneling tools, such as iodine, DNSStager, dnscat2, sliver, and Cobalt Strike , etc. These tools support encoding common messages into subdomains of DNS queries and various types of DNS responses, such as A (IPv4 address), AAAA (IPv6 address), TXT, CNAME, and MX.

Applying DNS tunneling to C2

C2 is the most common application scenario of DNS tunneling technology. The same activity can share some characteristics, such as using the domain name server used for communication as C2, or using common tunneling tools to implement encoding and decoding.

The first example is a campaign targeting an organization in the financial sector, where we observed communications between 22 tunnel domains and the same target user.

These domains shared seven name server IPs and used the same underlying encoding tools. The attackers even applied for seemingly identical security/cloud provider domains in an attempt to evade detection.

These domains include:

panos[.]ltd

ciscocloud[.]space

ubrella[.]online

msft[.]center

mscd[.]store

awsl[.]site

We have listed these domains with their example queries, nameserver domains, and nameserver IPs in the table below:

domain name

Query Example

Domain Name Server

Domain Name Server IP

panos[.]ltd

10.eff89fcf44a13186ad3765f35860ce19c722c4bcda6bbbae6b7bab6025b36d0.d036b5a3fd8b67e55ee35fe ff7d014fdb8d32afe93d5d6f05f1dda3a096e8fa.2e10d53e935549b3a081982724c3e6f806.oak.panos[.]ltd

bur.panos[.]ltd

34.92.43[.]140

ciscocloud[.]space

10.a6674ae5d37cab7263074adef14925ef28698896b8491276097a470beca325a.669f12d4b31e9a6707ce2ee5b595cb723 f40ea6d8e5f406b8fba874c8bec632.3299de58f43c3e4be80a7d7db2a2ed5aee9e13bac9cb.habit.ciscocloud[.]space

bram.ciscocloud[.]space

34.92.43[.]140

ubrella[.]online

8.d4fee8aa63e4ee6435452f86e84464168e96e314eb1a19c45e0e76f3ca71b2a.e9476062765ba0aeaeea97333805f094 70ff3bd103e3ce8bd3ffefa3dfea90f.369cd352a204e9662db180407f1d1b8fa87be97c81d1.feign.ubrella[.]online

rumor.ubrella[.]online

34.92.43[.]140

mscd[.]store

4.a6gpmbnqbjewgwnqnlivwhleux4vnnyiuduyqgjkyn9jcihsttpdbdenf7lx8jx.jqhdulrejthsyipzvoleyvhv5s99nydtj5um8bzdmdms9gwdqnq46yis5hv bryo.dernuvjw7a6p6ndq4c8lwomsl7zq5lncgsutndxfpaufefhr7xxeuhfpk8hs.sny7htmpdpqdcumtgrmeptytbe9p78skry64.17328.fish.mscd[.]store

rug.mscd[.]store

35.194.255[.]111

awsl[.]site

1.758fcd0ac2301084ef82efb047050ff5e7d45b4cd636b46e4292b67acac5ab0.a1644dfde400b8d41e7b6ec37338c 45d34a8e9ed81173e8dffdf57ebb3c9e30.9fc12877d608dfca610d50a121acbd30b2450391c13a.mud.awsl[.]site

lkas.awsl[.]site

35.194.255[.]111

msft[.]center

10.c5f310abb43603a3af324ee92bea16c8132ec2909fbca8d1036fe409d33af9b.c8c30e936bffb9f93bcba2c27682d cca1ab79aced6d1cf015a11d56a9c2f9f5.c49d8757a19b693d78d1772977cbf164e2748b57bb9f.ud.msft[.]center

08e099da.msft[.]center

34.81.65[.]4

Our second example is an activity targeting another financial industry customer. We found that three tunnel domains all pointed to the same customer and used the same underlying tunneling tool - Cobalt Strike. Representative characteristics of Cobalt Strike include the use of common prefixes such as www, post, and api.

The three domains are identity-mgmt[.]com, internalsupport[.]info, and cloud-enrollment[.]com. Below are the corresponding query samples, name servers, and IP addresses:

domain name

Query Example

Domain Name Server

Domain Name Server IP

cloud-enrollment[.]com

api.12abc2cb5.446f35fa.dns.cloud-enrollment[.]com

ns1.cloud-enrollment[.]com

3.238.113[.]212

identity-mgmt[.]com

intact.md.180.02d8f18d2.7e8986be.int.identity-mgmt[.]com

ns1.cloud-enrollment[.]com

3.238.113[.]212

internalsupport[.]info

icr.0325e18d8.16ae9fb2.pl.internalsupport[.]info

dn.internalsupport[.]info

3.238.244[.]129

Summarize

Nowadays, more and more cyber gangs are applying DNS tunnel communication technology to various places, including C2 servers and VPN services, etc. Therefore, as a security defense personnel, it is very important to understand the use of DNS tunnel technology in the wild. Only by understanding the underlying tools and related activities of DNS tunnel communication can we achieve fine-grained analysis and thus achieve rapid response to security incidents.

Intrusion threat indicators IoC

domain name

panos[.]ltd

ciscocloud[.]space

ubrella[.]online

mscd[.]store

awsl[.]site

msft[.]center

cloud-enrollment[.]com

identity-mgmt[.]com

internalsupport[.]info

claudfront[.]net

allowlisted[.]net

hsdps[.]cc

rcsmf100[.]net

hammercdntech[.]com

IP address

34.92.43[.]140

35.194.255[.]111

34.81.65[.]4

3.238.113[.]212

3.238.244[.]129

5.252.176[.]63

83.166.240[.]52

5.252.176[.]22

194.31.55[.]85

65.20.73[.]176

Other References

https://unit42.paloaltonetworks.com/tag/dns-tunneling/

https://unit42.paloaltonetworks.com/solarstorm-supply-chain-attack-timeline/

https://unit42.paloaltonetworks.com/dns-tunneling-how-dns-can-be-abused-by-malicious-actors/

https://www.bamsoftware.com/software/dnstt/

https://blogs.infoblox.com/cyber-threat-intelligence/cyber-threat-advisory/dog-hunt-finding-decoy-dog-toolkit-via-anomalous-dns-traffic/

https://unit42.paloaltonetworks.com/dns-tunneling-in-the-wild-overview-of-oilrigs-dns-tunneling/

https://unit42.paloaltonetworks.com/oilrig-novel-c2-channel-steganography/

References

https://unit42.paloaltonetworks.com/dns-tunneling-in-the-wild/

Author of this article: FreddyLu666, please indicate that it is from FreeBuf.COM when reprinting

<<:  A Comprehensive Guide to Fiber Optic Connector Types and Their Applications

>>:  [Important Event] Be neither arrogant nor give up, stick to the original intention, the 2023 Jinrui Marketing Award works collection is officially launched

Recommend

How does millimeter wave technology unleash the future potential of 5G?

Currently, the major 5G development countries in ...

MIIT releases three-year action plan for industrial internet

MIIT releases three-year action plan for industri...

Smartphones supporting Wi-Fi 6/6E will dominate the market by 2025

Wi-Fi 6E will be commercially available in 2021. ...

The network was interrupted for 30 minutes! Operator: Please restart your phone

At 1:50 p.m. local time on March 29, Japanese ope...

Analysis of 5 promising 5G smart interconnection application industries

2019 saw the emergence of 5G commercial capabilit...

Hostodo: $17.99/year KVM-1GB/12GB/4TB/Las Vegas

Hostodo is a foreign VPS hosting company founded ...

Detailed explanation of HTTP protocol security-related headers

HTTP security headers are a fundamental part of w...

The beauty of 5G phone is like being in your ear

[[352290]] This article is reprinted from the WeC...