EC2 Takeover at turn.shopify.com
The domain turn.shopify.com had a dangling A record pointing to a terminated EC2 instance's IP address. The reporter registered a new EC2 instance with that IP, gaining control over the subdomain and demonstrating stored XSS and DoS.
- Fixed in 7 hours
- Paid in 8 days
- Disclosed after 8 months
Summary Hi team, It seems that the domain turn.shopify.com pointed to an EC2 instance that was terminated and the DNS record wasn't updated. We managed to register a new EC2 instance with the IP that turn.shopify.com points to:
Command
dig turn.shopify.com
; <<>> DiG 9.11.3-1ubuntu1.13-Ubuntu <<>> turn.shopify.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5523
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;turn.shopify.com. IN A
;; ANSWER SECTION:
turn.shopify.com. 3600 IN A 54.90.1.144
;; Query time: 17 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Aug 09 10:41:14 CEST 2021
;; MSG SIZE rcvd: 61
URL
http://turn.shopify.com/0xd0m7
POC

Saved at:
https://archive.ph/4ro3x
Impact
An EC2 takeover has the same impact as a subdomain takeover, instead of having a dangling CNAME there is a dangling A record. With it we are able to: Serve phishing pages which are bound to be trusted, since there is no way of finding out that we are the owners. Besides, we could also get an SSL certificate to serve the content via HTTPS. For demonstration purposes we have only opened port 80. Stored XSS and DoS, as shown in the PoC. Privilege escalation: we will be checking upon submission of the report, it could be possible to use an XSS to exfiltrate personal information or take over accounts. A comment will be added if this is the case. SSH sniffing: it'd be possible to open ports and install different services on the machine, amongst them an ssh or ftp server to capture credentials. Malware distribution. And many more, basically everything since we now have control over one of your domains.
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 the DNS A record for the subdomain was not removed after the EC2 instance it pointed to was terminated, allowing anyone who obtains that IP address to take over the subdomain.
Impact
An attacker could serve phishing pages, stored XSS, DoS, malware, and potentially sniff SSH credentials, all under a trusted Shopify subdomain; the reporter only opened port 80 for demonstration.
What the attacker needed
Ability to register an EC2 instance with a specific IP
The fix
The DNS record should be removed or updated when the EC2 instance is terminated.
How it was found
- Query the DNS A record for turn.shopify.com to find the IP address.
- Register a new EC2 instance with that same IP address.
- Serve content from the new instance, demonstrating stored XSS and DoS.
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 DNS record is like a phone book entry that tells computers where to find a website. Here, the entry for turn.shopify.com still pointed to an old server that had been shut down, so the reporter was able to claim that same address and put their own server there. This let them control what visitors to that subdomain would see.
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.