Tuesday, February 25, 2014

As of early February I have been observing new weird DNS requests that I think can only be labeled as an Resource Exhaustion Attack against Authoritative Name Servers. An attack strong enough to cripple DNS providers that are hosting thousands and thousands of domains....

Though I am hearing a lot of sounds about it being related to malware but evidence for that has yet to surface.

The first report I read about this was the following post on Spiceworks[1], where some people labeled this as an in -or out going DNS amplification attack. Since then I have heard from DNS admins from all over the world who where seeing similar traffic and rules they wrote to defend themselves against it.

I believe that this attack is also what was troubling some Linux PowerDNS[2] installs.

Amplification Attacks

When an attacker wants to take down a website or host it has different ways to do so. One of which is a Denial of Service (DOS) attack. One common form of attack is a DNS and since recently NTP Reflective Amplification Attacks. These attacks focus on flooding the internet pipe of the victim with useless traffic generated by open DNS/NTP servers on the web.

For these attacks to work an attacker needs -multiple- host with 1gbit uplinks and the ability to spoof source IPs on that AS and a list of good Open DNS/NTP servers.

A good open server is in this case a DNS or NTP server that is capable of sending a much larger response to a small request. For DNS one would search for DNS server supporting EDNS and for NTP servers that support the Monlist command.

The attack

The DNS based attack I have been observing does not require very high quality DNS servers, actually any open resolver will do.

The attackers simply floods the open resolver(s) with non-existent sub-domains for a domain. This will require the resolver to query the DNS hierarchic and contact the authoritative name server for the domain. One can imagine the effects of hundreds, thousands or even millions of open resolvers contacting the same bunch of authoritative name servers with unique requests multiple times per second.

While writing this blog I observed lots of queries to *.www.0538hj.com. The name servers for this domains are:

;; QUESTION SECTION:;0538hj.com. IN NS;; ANSWER SECTION:0538hj.com. 60345 IN NS dns11.hichina.com.0538hj.com. 60345 IN NS dns12.hichina.com.;; ADDITIONAL SECTION:dns12.hichina.com. 84272 IN A 223.5.2.82dns12.hichina.com. 84272 IN A 121.196.255.82dns12.hichina.com. 84272 IN A 121.196.255.132dns11.hichina.com. 84272 IN A 223.5.2.131dns11.hichina.com. 84272 IN A 121.196.255.81dns12.hichina.com. 84272 IN A 42.96.255.82dns11.hichina.com. 84272 IN A 42.96.255.81dns12.hichina.com. 84272 IN A 42.96.255.132dns11.hichina.com. 84272 IN A 223.5.2.81dns11.hichina.com. 84272 IN A 42.96.255.131dns11.hichina.com. 84272 IN A 121.196.255.131dns12.hichina.com. 84272 IN A 223.5.2.132

While this attack was ongoing it was very difficult to get a response from one of these servers. Goes to show how effective the attack is.

About 1 out of 8 queries seemed to get an answer.
The query rate was about 2 - 8 queries per second.

First!

My logs suggest I first started seeing these attacks on Febuary the 3th with domain: abpdesthvwxyz.gb41.com.
The following graph shows the amount of unique domain names this resolver has been seeing each day in February.

Normally this would only be about 10 a day as this server is not used in any legitimate way but participates only in DNS amp and receives some DNS scans. On days I have been seeing these attacks I have seen spikes as high as 16.000 unique domains.

Domains the method - Name Servers the targets

Over time I have seen a multitude of domains. Here are some of the bigger attacks I have seen. The count represent the amount of sub-domains I observed that day. As each sub domain is only requested once this is equal to the amount of IPs and requests.

Name servers:

The above domains use the following name servers and we can assume that during these attacks these name servers where very difficult to reach.

4 iidns.com.

3 hichina.com.

3 dnsabc-b.com.

2 dnsabc-g.com.

3 gfdns.net.

1 zndns.com.

1 51dns.com.

1 360wzb.com.

1.gfdns.net.

1 51dns.com.

1 domaincontrol.com.

1 dnspod.com.

Most of these name servers belong to Chinese registrars. Some of these registrars are responsible for up to half a million domains.

Spoofed or not?

Each DNS query is received from a different IP-address. This suggest spoofing but not in the way it is used with reflective amplification attacks, to specify the target. Here it seems to be used to cloak the origin of these queries from the resolvers.

I keep track of a few values for each query that comes in. Among others its Time To Live (TTL), a value that is not often spoofed.

13 hops difference, that could be the difference between a request from Europe or the US a change like that doesn't add up. I call that evidence of spoofing.

Detection

For me it is pretty easy to detect these attacks now that I know what to look for. But I am fortunate enough to have very little legit traffic so this malicious traffic stands out nicely. When running a (very) large resolver for a network it will be more difficult to spot, let alone block.

Characteristics
So far I have only seen queries for:

- All queries are for A records
- No OPT resource record in query
- One label is randomized
-The random sub-domain contains only chars a-z
- Random sub-domain label length is between: 1 <> 16

Remedy

Automatically flagging of these domains might result in false positive. So until a characteristic is found that can be used to isolate this traffic more specifically it will be mainly manual labor to maintain blacklists.

One way of dropping this traffic would be by using the IPtables strings module:

NOTICE: The expiration date displayed in this record is the date the registrar's sponsorship of the domain name registration in the registry is currently set to expire. This date does not necessarily reflect the expiration date of the domain name registrant's agreement with the sponsoring registrar. Users may consult the sponsoring registrar's Whois database to view the registrar's reported date of expiration for this registration.

Source:

Name server:

Response:

A 241 NS 2 SOA 1 Rsize 3952

Whois

% By submitting a query to RIPN's Whois Service% you agree to abide by the following terms of use:% http://www.ripn.net/about/servpol.html#3.2 (in Russian) % http://www.ripn.net/about/en/servpol.html#3.2 (in English).

NOTICE: The expiration date displayed in this record is the date the registrar's sponsorship of the domain name registration in the registry is currently set to expire. This date does not necessarily reflect the expiration date of the domain name registrant's agreement with the sponsoring registrar. Users may consult the sponsoring registrar's Whois database to view the registrar's reported date of expiration for this registration.

This listing is a Network Solutions Private Registration. Mailcorrespondence to this address must be sent via USPS Express Mail(TM) orUSPS Certified Mail(R); all other mail will not be processed. Be sure toinclude the registrant's domain name in the address.

The data in Networksolutions.com's WHOIS database is provided to you byNetworksolutions.com for information purposes only, that is, to assist you inobtaining information about or related to a domain name registrationrecord. Networksolutions.com makes this information available "as is," anddoes not guarantee its accuracy. By submitting a WHOIS query, youagree that you will use this data only for lawful purposes and that,under no circumstances will you use this data to: (1) allow, enable,or otherwise support the transmission of mass unsolicited, commercialadvertising or solicitations via direct mail, electronic mail, or bytelephone; or (2) enable high volume, automated, electronic processesthat apply to Networksolutions.com (or its systems). The compilation,repackaging, dissemination or other use of this data is expresslyprohibited without the prior written consent of Networksolutions.com.Networksolutions.com reserves the right to modify these terms at any time.By submitting this query, you agree to abide by these terms.

Source:

Name server:

Response:

A 13 MX 28 NS 2 SOA 1 TXT 11 Rsize 4006

Whois

% By submitting a query to RIPN's Whois Service% you agree to abide by the following terms of use:% http://www.ripn.net/about/servpol.html#3.2 (in Russian) % http://www.ripn.net/about/en/servpol.html#3.2 (in English).