DNS injection is a type of a DNS poisoning attack in which, a network traffic monitoring device injects fake DNS responses.
We'll use The Great Firewall of China (GFW) to demonstrate this attack in practice.
Let's query wikipedia.org against Google DNS to get a baseline.
dig wikipedia.org @8.8.8.8
; <<>> DiG 9.10.6 <<>> wikipedia.org @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61120
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;wikipedia.org. IN A
;; ANSWER SECTION:
wikipedia.org. 234 IN A 91.198.174.192
We can confirm in a WHOIS database that this IP address in fact belong to Wikimedia Foundation.
Let's run the same query against a DNS server in China. We'll use DNS server with address 1.2.4.8.
dig wikipedia.org @1.2.4.8
; <<>> DiG 9.10.6 <<>> wikipedia.org @1.2.4.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21972
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;wikipedia.org. IN A
;; ANSWER SECTION:
wikipedia.org. 170 IN A 162.125.32.9
Checking WHOIS data we see that this IP address doesn't belong to Wikimedia. Instead it belongs to Dropbox.
Examining the network traffic, we see that in fact we received not one but three responses.
- 162.125.32.9 -> Dropbox
- 108.160.165.147 -> Dropbox
- 67.228.102.32 -> Softlayer
None of them belongs to Wikipedia.
To further demonstrate that this is a network based attack, we try to send a DNS query to an IP address that is not a DNS server and it's not even in use. We'll test this against 1.2.3.244.
First let's ping it to make sure there's nothing there.
PING 1.2.4.244 (1.2.4.244): 56 data bytes
Request timeout for icmp_seq 0
Now let's query it.
The response gets injected by the injector.
Observant reader will notice that this time we've received two instead of three responses. We will cover why that is the case in a post dedicated to the Great Firewall of China DNS blocking.
IP addresses in injected responses
The fake response can contain anything the attacker chooses.These can be:
- Publicly routable IP addresses blocked at the network level (for example BGP black-holed) or not serving any conten
- IP addresses of specific block pages
- Local host address
- Private IP addresses (non-internet routable)
- DNS error for example NXDOMAIN
The Great Firewall of China in its forged responses returns IP addresses from IP ranges owned by US companies such as Dropbox, Facebook, Twitter, Softlayer. This behaviour is specific to the GFW[ref 1] .
For example in Indonesia or Korea forged responses contain IP address that redirect users to block page.
References:
1 "How Great is the Great Firewall?" https://www.usenix.org/system/files/sec21-hoang.pdf
Comments
Post a Comment