DNS
DNS protocol can be modelled in nuclei with ease. Fully Customizable DNS requests can be sent by nuclei to nameservers and matching/extracting can be performed on their response.
DNS Requests start with a dns block which specifies the start of the requests for the template.
Type
First thing in the request is type. Request type can be A, NS, CNAME, SOA, PTR, MX, TXT, AAAA.
Name
The next part of the requests is the DNS name to resolve. Dynamic variables can be placed in the path to modify its value on runtime. Variables start with {{
and end with }}
and are case-sensitive.
- FQDN - variable is replaced by the hostname/FQDN of the target on runtime.
An example name value:
As of now the tool supports only one name per request.
Class
Class type can be INET, CSNET, CHAOS, HESIOD, NONE and ANY. Usually it’s enough to just leave it as INET.
Recursion
Recursion is a boolean value, and determines if the resolver should only return cached results, or traverse the whole dns root tree to retrieve fresh results. Generally it’s better to leave it as true.
Retries
Retries is the number of attempts a dns query is retried before giving up among different resolvers. It’s recommended a reasonable value, like 3.
Matchers / Extractor Parts
Valid part
values supported by DNS protocol for Matchers / Extractor are -
Value | Description |
---|---|
request | DNS Request |
rcode | DNS Rcode |
question | DNS Question Message |
extra | DNS Message Extra Field |
answer | DNS Message Answer Field |
ns | DNS Message Authority Field |
raw / all / body | Raw DNS Message |
Example DNS Template
The final example template file for performing A
query, and check if CNAME and A records are in the response is as follows:
More complete examples are provided here