From Browser JavaScript to AWS Metadata: Cracking Encryption and
The web application encrypted API requests client-side using AES with a hardcoded passphrase found in a JavaScript bundle. An attacker could decrypt and modify requests, leading to a server-side request forgery (SSRF) that allowed access to internal services and AWS EC2 metadata, exposing temporary cloud credentials.
Published on medium.com
How I reverse-engineered client-side AES logic encryption, decrypted a hidden payload, and got the SSRF.
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 application relied on client-side encryption with a hardcoded key for security, and the server accepted arbitrary URLs in decrypted requests without validating them, enabling SSRF.
Impact
An attacker could decrypt and modify API requests, leading to SSRF that exposed internal services and AWS EC2 metadata, including temporary credentials for an S3 read-only role.
What the attacker needed
Access to the web application; ability to intercept HTTP traffic; knowledge of JavaScript
How it was found
- Capture a request in Burp and notice that AJAX requests and responses are encrypted client-side.
- Use a bookmarklet or browser extension to list all loaded JavaScript files.
- Run a static grep scan for crypto patterns like AES.encrypt and Salted__ in the JS chunks.
- Identify a chunk containing CryptoJS.AES.encrypt logic and a hardcoded passphrase.
- Build a Python script to decrypt AES-CBC payloads using OpenSSL EVP_BytesToKey derivation.
- Decrypt requests to find an endpoint /api/service that accepts a URL field, then craft an encrypted request to an internal URL and later to the AWS metadata endpoint.
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.
The website scrambled data in the browser before sending it, using a secret key that was actually written in the public JavaScript code. Anyone could find that key, unscramble the data, and change it to make the server do unintended things, like fetch internal web pages or cloud secrets.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.