Subdomain takeover on https://cloudfront.ubnt.com/ due to non-used CloudFront DNS entry
A DNS record for a subdomain pointed to a CloudFront distribution that was no longer in use, allowing anyone to claim that distribution and serve content on the subdomain. An attacker could then host malicious content, obtain a TLS certificate, and read cookies or conduct phishing.
- Triaged in 32 days
- Fixed in 36 days
- Disclosed after 2 months
Summary by the researcher
I see LFI via SQL injection that the vulnerability was serious and I have limit report. But team UBNT not reward for me.
The report
So lately I have discovered that CloudFront is not validating which user that connects a CNAME:d domain to a CloudFront Origin. This means that if I could find a domain that is still pointing to CloudFront, without being connected to any Origin as a Custom CNAME, I can actually claim the domain myself and point it to whatever I want.
dig cloudfront.ubnt.com
; <<>> DiG 9.10.3-P4-Debian <<>> cloudfront.ubnt.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52550 ;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;cloudfront.ubnt.com. IN A
;; ANSWER SECTION: cloudfront.ubnt.com. 268 IN CNAME du6drkqe7qw4g.cloudfront.net. du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.58 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.143 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.238 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.216 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.144 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.190 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.55 du6drkqe7qw4g.cloudfront.net. 29 IN A 52.222.171.71
;; Query time: 7 msec ;; SERVER: 192.168.1.1#53(192.168.1.1) ;; WHEN: Wed Feb 22 03:26:49 MSK 2017 ;; MSG SIZE rcvd: 218
;; ANSWER SECTION: cloudfront.ubnt.com. 268 IN CNAME du6drkqe7qw4g.cloudfront.net.
You should most likely just remove the DNS-entry for this domain, and also make sure you constantly remove DNS records pointing to CloudFront (and other services as well of course) when you stop using them.
As you might understand, the consequences of this are pretty bad. I now can serve whatever I like on this domain, even fetching httpOnly cookies. I would also be able to issue an SSL for this domain through AlphaSSL or Let's Encrypt (that only needs meta/file verification to issue the certificate) That would end up with the ability to read secure cookies as well.
Also, there's no way at all for a visitor of this page to validate that the content on this domain is not served by UBNT, making it extremely easy to utilize this for targeting the organization by fake login forms / spear phishing using your own domain to plant the attack.
You can read about this sort of attacks here : http://labs.detectify.com/post/109964122636/hostile-subdomain-takeover-using
Attachments

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a dangling DNS record pointing to a CloudFront distribution that was no longer in use, allowing anyone to claim it.
Impact
An attacker could serve arbitrary content on the subdomain, potentially reading cookies, obtaining a TLS certificate, and conducting phishing attacks.
What the attacker needed
DNS record points to unused CloudFront distribution; Attacker can create a CloudFront distribution
The fix
The DNS entry for the subdomain should be removed, and DNS records pointing to CloudFront should be regularly cleaned up when no longer used.
How it was found
- Query DNS for the subdomain and observe it is a CNAME to a CloudFront distribution.
- Check that the CloudFront distribution is not configured with that domain as a custom CNAME.
- Claim the domain by creating a new CloudFront distribution with the same CNAME.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A subdomain takeover happens when a company's subdomain points to an external service that is no longer configured. An attacker can register that same service and take control of the subdomain, letting them host their own content on the company's domain. This can be used to steal cookies or trick users with fake login pages.
What is Subdomain takeover?
A company's DNS still points at a cloud service it no longer uses, so anyone can claim it and serve content on the company's domain.