The 12 500 Dns Trick That Hacked Snapchats Cloud Servers
The Snapchat Business creative import feature fetched and executed JavaScript from user-supplied URLs, allowing an attacker to run code in Snapchat's cloud environment. Using DNS rebinding, the researchers redirected the JavaScript to the Google Cloud metadata service and exfiltrated SSH keys, service account tokens, and internal credentials.
Published on infosecwriteups.com
While studying advanced SSRF techniques, I came across a fascinating case where researchers @nahamsec, @daeken, and @ziot combined DNS rebinding with cloud metadata services to compromise Snapchat’s internal infrastructure. Their clever attack demonstrates how even well-protected cloud environments can be vulnerable…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the import service executed JavaScript from remote URLs without validating or sandboxing the content, and the cloud instances could reach the metadata service without network restrictions.
Impact
The researchers could access production cloud instances and credentials, internal development environments, and test credentials with internal access, though Snapchat noted these did not access critical systems.
What the attacker needed
Access to Snapchat Business platform; Ability to host a malicious page; Control over a domain for DNS rebinding
The fix
Snapchat implemented multiple layers of protection including IPTables rules to block metadata service IP ranges, improved URL validation, better network segmentation, and enhanced monitoring.
How it was found
- Create a malicious HTML page that executes JavaScript and attempts to contact the Google metadata service.
- Initially point the domain to a harmless server controlled by the attacker.
- Once Snapchat's service fetches the page, quickly change DNS to point to the metadata IP address.
- The JavaScript continues running and makes requests to the metadata service instead of the attacker's server.
- Harvest SSH keys, service account information, instance hostnames, and internal credentials.
- Exfiltrate the stolen data back to the attacker's controlled server.
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 write-up has not been written yet. The Original tab links to the source.
A feature that imports images from a web address was actually running any JavaScript it downloaded, not just showing pictures. The researchers made their own web address first point to a harmless server, then quickly switched it to point to a special cloud address that holds secret keys. Because the code was already running inside Snapchat's network, it could read those secrets and send them out.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.