Skip to content
SSRF Write-up Intermediate

SSRF to S3 to Shell: The One-Key Takeover That Started With a Misconfigured Proxy

A debug endpoint accepted a user-supplied URL and fetched it, allowing an attacker to reach the EC2 metadata service and steal temporary AWS credentials. Those credentials gave access to a production S3 bucket containing backups with secrets, which the attacker used to escalate to admin impersonation and remote code execution.

narendarlb123 Follow

Published on medium.com

looked harmless — just a debug utility that accepts a url param. But when fuzzed:

Narendar Battula (nArEn), on medium.com

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 a debug endpoint that fetched arbitrary user-supplied URLs without validation, combined with an EC2 instance role that had broad S3 permissions and backups stored with plaintext secrets.

Impact

The attacker could read production backups, forge admin sessions, and achieve remote code execution, resulting in full infrastructure compromise.

What the attacker needed

Access to the debug endpoint; no authentication required; EC2 instance with an IAM role; S3 bucket with sensitive backups

The fix

The debug endpoint should validate and allowlist outbound URLs, the EC2 role should follow least privilege, S3 buckets should block public access and not store plaintext secrets, and secrets should be kept in a secrets manager.

How it was found

  1. Send a request to the debug ping endpoint with a URL pointing at the EC2 metadata service.
  2. Query the metadata service for the attached IAM role name.
  3. Query the metadata service for that role's temporary credentials.
  4. Use the stolen credentials with the AWS CLI to list and download the production backup bucket.
  5. Extract secrets from the downloaded files, including a JWT secret and a GitHub token.
  6. Use the GitHub token to clone private repositories and find internal admin and debug endpoints, then forge admin tokens and achieve remote code execution.

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 debug endpoint let anyone make the server fetch a web address of their choosing. The attacker pointed it at a special internal address that only cloud servers can see, which hands out temporary passwords for the cloud account. Those passwords opened a backup storage bucket full of secrets, and the secrets let the attacker take over the whole system.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by narendarlb123

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.