Skip to content
Leaked secrets Write-up Beginner

Owning half of a government assets through AWS

AWS access keys were exposed in the public JavaScript source of a web application, allowing an attacker to access and control many AWS resources including S3 buckets and EC2 instances containing citizen data.

g30rgy th3 d4rk Follow

Published on crypt0g30rgy.github.io

So it was on one evening, i was looking at targets at intigriti that had wide scope, (and offered some compensation to hackers for the time invested).

g30rgy th3 d4rk (@Crypt0g30rgy), on crypt0g30rgy.github.io

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 developers embedded AWS credentials directly in the client-side JavaScript configuration, assuming the SSO login would prevent anyone from seeing the source.

What the attacker needed

Publicly accessible web app; No authentication needed to view source

The fix

The exposed keys were later secured with two-factor authentication, but the proper fix is to remove secrets from client-side code and use temporary, scoped credentials.

How it was found

  1. Visit the target domain and observe redirection to SSO.
  2. Stop the redirect and view the page source.
  3. Open the main JavaScript file and search for 'aws'.
  4. Extract the AWS access key and secret from the configuration.
  5. Configure an AWS profile with the keys and run commands to list S3 buckets and EC2 instances.

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's code, which anyone can view, accidentally included the username and password (access keys) for its Amazon cloud account. With these keys, the attacker could log in to the cloud account and read or change data stored there.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by g30rgy th3 d4rk

View all

7 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.