0

I have found research efforts on explaining how sub domain takeovers can take place authored by a gentleman named "Patrik Hudák". Through his site's blogs he illustrates and conveys an understanding of the phenomenon:

https://0xpatrik.com/subdomain-takeover/

He has also crafted a Master's thesis on the subject matter:

https://is.muni.cz/th/byrdn/Thesis.pdf

I would like to find specific fields of interest using some advised tools such as dig, whois and curl to distinguish if a subdomain is vulnerable or not.

1

I actually know Patrik personally and will definitely ping him concerning your request.

I have published numerous technical write-ups on subdomain takeovers that include identifying vulnerable hosts using common commands and libraries that may be of interest to you. The best starting point is probably "A guide to subdomain takeovers".

Setup and workflow

If you want a really basic setup, I would advise to use a combination of a subdomain enumeration tool to retrieve a list of subdomains for your target, meg for sending requests and storing the responses in a local folder, and then grepping for fingerprints listed in "Can I takeover XYZ?" (most subdomain takeover related tools rely on this project for identifying vulnerable hosts) in the folder where meg stored the responses.

A basic workflow using the tools listed above would look roughly as follows.

1) Enumerate subdomains using a tool such as subfinder (the process that these tools use is described in detail in the HackerOne write-up linked above);

$ subfinder -d example.com -o output-tmp.txt

2) Ensure that all hosts are prefixed with http:// so that they can be run through meg. You could also use httprobe, which is a slower process but might yield better results;

$ sed 's#^#http://#g' output-tmp.txt > output.txt

3) Run meg to fetch the index pages of all the enumerated subdomains;

$ meg -L -c 200 / output.txt responses

4) Grep through the responses for fingerprints associated with vulnerable subdomains.

$ grep -Hnri "There isn't a Github Pages site here." responses

Practice

In my opinion, the simplest way to learn about subdomain takeovers is to point a subdomain of yours to GitHub pages and to follow the steps above to claim it. This should give you a feel for the entire workflow and possibly give you a better idea of the security implications.

Further reading

"DNS hijacking using cloud providers – No verification needed" by Frans Rosén covers a lot of the steps described in the previous section. He also goes into detail about how he identifies vulnerable subdomains and lists a couple of tricks to make your workflow more efficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.