SlideShare a Scribd company logo
detectify
DNS hijacking using cloud providers
– no verification needed
detectify
Frans Rosén
Security Advisor @detectify ( twitter: @fransrosen )
HackerOne #5 @ hackerone.com/leaderboard/all-time
Blog at labs.detectify.com
Talked here last year!
"The Secret life of a Bug Bounty Hunter"
detectify
Rundown
• Background
• History
• Tools & Techniques
• Deeper levels of hijacking
• Evolution
• Mitigations
• Monitoring
detectify
Subdomain Takeover v1.0
campaign.site.com
Campaign!
detectify
Subdomain Takeover v1.0
campaign.site.com
Campaign! Fake site!
detectify
Ever seen one of these?
detectify
First instance, 12th Oct '14
http://esevece.tumblr.com/post/99786512849/onavo-cname-records-pointing-to-heroku-but-no
detectify https://labs.detectify.com/2014/10/21/hostile-subdomain-takeover-using-herokugithubdesk-more/
9 days later, 21st Oct '14
detectify
Response from services
Heroku: 

“We're aware of this issue”
GitHub: 

“My apologies for the delayed response.
We are aware of this issue”
Shopify: 

“I had already identified that this is
a security issue”
detectify
What have we seen?
detectify
What have we seen?
https://hackerone.com/reports/172137
detectify
What have we seen?
detectify
What have we seen?
https://hackerone.com/reports/32825
detectify
What have we seen?
detectify
What have we seen?
https://crt.sh/?q=%25.uber.com
detectify
What have we seen?
https://blog.rubidus.com/2017/02/03/deep-thoughts-on-subdomain-takeovers/
detectify
What have we seen?
https://labs.detectify.com/2016/10/05/the-story-of-ev-ssl-aws-and-trailing-dot-domains/
detectify
What have we seen?
detectify
What have we seen?
detectify
What have we seen?
detectify
Tools
detectify
subbrute
Not active dev.
https://github.com/TheRook/subbrute
detectify
Sublist3r
https://github.com/aboul3la/Sublist3r
Active dev! Took over subbrute!
Fetching from multiple sources
detectify
massdns
https://github.com/blechschmidt/massdns
Fast as hell!
Needs lists to resolve
detectify
altdns
https://github.com/infosec-au/altdns
Soo soo powerful if you have good mutations
Combine with massdns == success
Can resolve, but better for just creating the lists
detectify
tko-subs
https://github.com/anshumanbh/tko-subs
Interesting idea, auto takeover when finding issues
Might be a liiittle bit too aggressive
detectify
We could look here?
detectify
WRONG!
WRONG!
WRONG!
WRONG!
WRONG!
WRONG!
WRONG!WRONG!
detectify
WRONG!
Resolve and not resolve is what matters.
detectify
Dead DNS records
detectify
A dead record?
detectify
A dead record?
detectify
dig is your friend
detectify
9 year old bug
detectify https://thehackerblog.com/the-orphaned-internet-taking-over-120k-domains-via-
a-dns-vulnerability-in-aws-google-cloud-rackspace-and-digital-ocean/index.html
SERVFAIL/REFUSED
detectify
Also works on subdomain delegations!
detectify
NOERROR
Resolves. All OK.
DNS status codes
detectify
DNS status codes
NXDOMAIN
Doesn’t exist. Could still have a DNS RR.
Query NS to find out more.
detectify
DNS status codes
REFUSED
NS does not like this domain.
detectify
DNS status codes
SERVFAIL
Not even responding. Very interesting!
detectify
The tools find what?
SERVFAIL
REFUSED
NOERROR
NXDOMAIN
????
detectify
Subdomain delegation
detectify
Subdomain delegation
detectify
Subdomain delegation
detectify
Brute add/delete R53 DNS
detectify
We now control the domain!
detectify
Orphaned EC2 IPs
https://www.bishopfox.com/blog/2015/10/fishing-the-aws-ip-pool-for-dangling-domains/
detectify
Orphaned EC2 IPs
detectify
dev.on.site.com
http://integrouschoice.com/
detectify
dev.on.site.com
detectify
dev.on.site.com
detectify
Flow
Brute
* Collect NOERROR
* Collect SERVFAIL / REFUSED +trace the NS
* Collect NXDOMAIN if CNAME, +trace
detectify
Flow
Resolve
* Check NOERROR for patterns
* SERVFAIL/REFUSED, Check NS for patterns
* NXDOMAIN, traverse up to apex, check:
NXDOMAIN|SERVFAIL|REFUSED|no servers could be reached
detectify
Flow
Improve
* Collect all subdomain names
* Sort them by popularity
* Sort www below all names with p>2
detectify
Flow
Analyze unknowns
* Collect titles of all sites (or EyeWitness!)
* Filter out common titles + name of company
* Generate screenshots, create a image map
https://github.com/ChrisTruncer/EyeWitness
detectify
Flow
Repeat
* Do it every day
* Push notification changes
detectify
Jan 2017
detectify
Jan 2017
detectify
Jan 2017
detectify
Jan 2017
detectify
Jan 2017
detectify
Jan 2017
detectify
Jan 2017
detectify
Monitoring is really preventing this.
Psst, this is exactly what we do!
Shameless plug
detectify
The competition
@avlidienbrunn @arneswinnen @TheBoredEng
detectify
My takeovers since 2014-10
detectify
detectify
Email snooping!
detectify
September 2016
http://blog.pentestnepal.tech/post/149985438982/reading-ubers-internal-emails-uber-bug-bounty
detectify
2 of the 3 in action
detectify
MX-records
Inbound mail. This is important.
detectify
MX-records
detectify
Conflict check + Validation
detectify
Oh, add this!
detectify
CNAME -> MX
detectify
Whitelisted aliases for verification
detectify
Back to this
detectify
Tadaa!
detectify
We now get postmaster!
detectify
Response the day after
detectify
Response the day after
detectify
Response the day after
detectify
On a final note
https://twitter.com/realdonaldtrump/status/190093504939163648
detectify
On a final note
https://twitter.com/realdonaldtrump/status/190093504939163648
detectify
On a final note
detectify
On a final note
detectify
On a final note
detectify
Recap
• Know your DNS Zone file

MX, CNAME, A, AAAA, ALIAS. Everything.

• AUTOMATION, probably the only proper solution
• will.i.am loves this
detectify
Go hack yourself!
Questions?
Frans Rosén (@fransrosen) – www.detectify.com

More Related Content

DNS hijacking using cloud providers – No verification needed