DNS Data exfiltration — What is this and How to use?

Search for a command to run...

No comments yet. Be the first to comment.
Ngoài pentest, hệ thống cần được kết hợp thêm nhiều các dịch khác nhằm tăng cường góc nhìn, tăng tính phản biện cho quá trình tìm lỗ hổng.

Recently, I have done a big update in RequestBin and release a new version called Next-Gen RequestBin. Now, let’s take a look at the 3 main features in this version. 1. Support both DNS and HTTP on an unique ID In this version, I have combined DNSBin...

Cách đây khoảng vài tháng, không hiểu vì lý do gì tôi không còn truy cập được trực tiếp dịch vụ Medium, hỏi han bạn bè thì mọi người cũng bị tình trạng tương tự. Cũng may tôi chưa xuống tiền mua gói membership không thì chắc khóc ròng mất mấy tháng. ...

Nếu người dùng từ Medium hay Ghost chuyển sang Medium, chắc hẳn bạn cũng sẽ như tôi, rất khó chịu về việc căn lề trái mặc định của editor. Mọi thứ bị xô lệch, cả chữ lẫn ảnh nhìn rất khó chịu. Kích hoạt tính năng tùy chỉnh giao diện Rất may một tr...

Tôi là 1 fan của Heroku vì tính tiện dụng và đặc biệt là giá trị của nó đối với các developer và các ứng dụng nhỏ. Tuy nhiên, gần đây tôi có phát triển dự án CVEData, dự án này đòi hỏi mức độ dữ liệu lớn và các gói của Heroku có vẻ không còn hợp lý n...

Summary: To test or exploit blind RCE, XXE,… the first thing which you think usually is outbound connection. Unfortunate, many importance servers are dropped the outbound connection. In such cases, you can use the DNS protocol to exfiltrate data. In this topic, I will talk about that technique.
There are 2 parts:
What is DNS Data exfiltration and how does it work.
I will introduce my new product (the http://requestbin.net) which have a tool for Data exfiltration through DNS protocol.
Actually, this is not new technical, according to the Akamai, this technique is about 20 years old. In a simple definition, DNS Data exfiltration is way to exchange data between 2 computers without any directly connection, the data is exchanged through DNS protocol on intermediate DNS servers.
Figure 1. A simple definition of DNS Data exfiltration
Back to basic, please follow a DNS resolution flow:
Figure 2. A DNS resolution flow (source: tcpipguide.com)
If you have managed a domain, please notice at step 9 and 11, client’s DNS Server (for example 8.8.8.8) will connect to a name servers returned from step 8 and 10; These name servers is settable via the Registrar’s DNS manager (for example: Go Daddy, Name Cheap,…). By setting the name servers (use NS records) be your own server, you can inspect to the request from client’s DNS Server.
Figure 3. A setting of NS records
Follow above settings, if ns1.requestbin.net is yours, you can view all subdomain which client requested. Attacker will put data into subdomain and receive it at the name server side. So, that is way to send data from victim (client) to attacker (the name server).
Figure 4. An example which uses DNS Data exfiltration (source: blogs.akamai.com)
In above example, the attacker wants to leak the password from compromised machine. The domain exfiltration.com is attacker’s and already set NS record to a server he owns. The malware in this case will make a dns resolution a domain which includes text content of the password is subdomain of the exfiltration.com. After that, attacker will view log at name server to get the password.
Similar to above technique, the client still make a dns resolution to exfiltration.com. However, instead of responding an A record, attacker’s name server will response a CNAME or TXT record which allow large unstructured strings to be sent from attacker to victim.
Figure 5. Use CNAME record to send data from outside
Of course, when you can send and receive data on DNS protocol, you can make a tunnel on that. With that technique, you will ssh, remote desktop or connect to any services of internal server. I will talk more about this technique in another topic.
In case you are interested in this, please read some bellow artices:
Follow the first part, to use the DNS Data exfiltration, you must at least have a domain and a name server which is setup to dns package inspection. It’s not complicate but not easy for anyone.
So, I have built a website (http://requestbin.net/dns) which supports to check some cases like blind RCE, XXE,.. and supports to send/receive data between outside and inside. And in particular, it’s very easy to use.
Figure 6. Screenshot of requestbin.net/dns
When visit the website, you maybe feel familiar about the interface. My website is based on requestb.in (https://github.com/Runscope/requestbin) which was down someday before and the code of DNS Data exfiltration is based on DNSBin (https://github.com/HoLyVieR/dnsbin)
In case you’re interested in this code, please visit the repository:
https://github.com/requestbin/requestbin.net
Any feedback is welcomed, please contact me at cuongmx[at]gmail[dot]com
Update 07/05/2022: I have released new version at https://m.cuong.mx/requestbin-next-gen-version-release-note-90826a854743
This is a copy version from Medium https://m.cuong.mx/dns-data-exfiltration-what-is-this-and-how-to-use-2f6c69998822