Skip to content
SSRF Write-up Advanced

The HTTP 303 Hack — From Python HTTP Client Defaults to AWS Cre

A user-controlled token_uri field in a BigQuery service account JSON was passed to the google-auth library without validation, allowing an attacker to make the server send a POST request to an arbitrary URL. By responding with an HTTP 303 redirect, the attacker could convert the POST to a GET, reach the AWS Instance Metadata Service, and read live IAM credentials from the error message that reflected the metadata response.

Alvin Ferdiansyah Follow

Published on infosecwriteups.com

This writeup documents the chain from a URL typed field inside a service account credential JSON to live AWS IAM credentials on a Kubernetes worker node. The chain depends on four components composing into a single vulnerability.

Alvin Ferdiansyah, on infosecwriteups.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 the token_uri field was not validated against an allowlist, the HTTP client followed redirects by default (including 303 which changes POST to GET), IMDSv1 was reachable from the pod, and the error path reflected the raw exception string containing the metadata response.

Impact

An authenticated user could obtain live, time-limited AWS IAM credentials for the EKS node role, enabling a pivot from a regular user account to the IAM role of the Kubernetes worker nodes.

What the attacker needed

Authenticated user account; ability to submit BigQuery connection config; attacker-controlled server reachable from platform; IMDSv1 enabled and reachable from worker pod

The fix

The token_uri field was fixed by validating it against an allowlist of standard Google OAuth2 token endpoints at the field-parsing layer.

How it was found

  1. Create a service account JSON with an attacker-controlled token_uri and submit it through the connection-testing feature.
  2. The backend forwards the JSON to a worker that uses google-auth to send a signed JWT to the token_uri.
  3. The attacker's server responds with a 303 redirect pointing to the AWS Instance Metadata Service.
  4. The HTTP client follows the redirect, converting the POST to a GET, and fetches the metadata.
  5. The metadata response is included in an error message returned to the user, revealing the credentials.

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 platform let users supply a web address (token_uri) that the server would contact when testing a connection. The server's HTTP library automatically follows redirects, and a special redirect code (303) changes a POST request into a GET request. The attacker used this to make the server fetch sensitive data from a special internal AWS address that only answers GET requests, and the server's error message showed that data back to the attacker.

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 Alvin Ferdiansyah

View all

3 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.