JudasDNS – Nameserver DNS poisoning attacks made easy

A DNS proxy server built to be deployed in place of a compromised nameserver to perform targeted exploitation.

Judas works by proxying all DNS queries to the legitimate nameservers for a domain. The magic comes with Judas’s rule configurations which allow you to change DNS responses depending on source IP or DNS query type. This allows an attacker to configure a malicious nameserver to do things like selectively re-route inbound email coming from specified source IP ranges (via modified MX records), set extremely long TTLs to keep poisoned records cached, and more.

Example Config

The following is an example configuration for Judas for an example scenario where an attacker has compromised/taken over one of Apple’s authoritative nameservers (for apple.com ):

version : The configuration file format version (for now is always 1.0.0 ).

port : The port Judas should run on.

dns_query_timeout : How long to wait in milliseconds before giving up on a reply from the upstream target nameserver.

target_nameservers : The legit nameservers for your target domain, all DNS queries will be sent here from Judas on behalf of all requesting clients.

rules : A list of rules with modifications to the DNS response to apply if matched.

name : Name of a given rule.

query_type_matches : List of query types to match on such as CNAME , A , etc. A wildcard ( * ) can also be specified to match any query type.

ip_range_matches : List of IP ranges to match on. For selectively spoofing responses to a specific range of IPs.

modifications : See the “Modifications” section of this README.

Modifications
Judas’s rules come with a modifications specification which is set to a list of varying modifications to make to the DNS response before it is sent back to the client. It is important that you read the node-dns documentation to understand the DNS response structure so you can modify it.
An example DNS response format is the following:

The above rule matches any query type (due to the wildcard ( * )) and sets the header.rcode value of the DNS response to 0 . Whatever object is set as a modification element is merged into the DNS response – replacing whatever value was originally set.
Another example is the following:

The above rule matches any MX query from 127.0.0.1 . The DNS response’s answer is overwritten with a single MX record for hacktheplace.localhost . A real world implementation of this would be to redirect inbound emails from a specific IP in order to read private emails of your target. Additionally an attacker in a real world scenario may also choose to modify the response TTL to be a very high value in order to persist their malicious records in client DNS caches as long as possible.