Beginner Friendly red team icon   azure

Exploit Weak Bucket Policies for Privileged Access

This beginner-friendly lab shows how overly permissive S3 bucket policies can leak and expose object contents even when listing the bucket is denied. Starting from hardcoded AWS credentials found in a shipping application, you enumerate the target website, read the bucket policy to discover accessible files, exfiltrate a password-protected spreadsheet, and crack it to recover credentials. Those credentials then unlock a hidden CRM containing sensitive customer data.

Overview

This beginner-friendly lab shows how overly permissive S3 bucket policies can leak and expose object contents even when listing the bucket is denied. Starting from hardcoded AWS credentials found in a shipping application, you enumerate the target website, read the bucket policy to discover accessible files, exfiltrate a password-protected spreadsheet, and crack it to recover credentials. Those credentials then unlock a hidden CRM containing sensitive customer data.

Scenario

During a red team engagement for Huge Logistics, your team recovered an IP address and hardcoded AWS credentials from a shipping application. Your objective is to pivot deeper into their cloud infrastructure and demonstrate impact by accessing sensitive data.

Lab prerequisites
  • Basic Linux command line knowledge
  • AWS CLI installed and configured
  • Familiarity with Nmap and Gobuster
Learning outcomes
  • Perform basic web and network enumeration with Nmap and Gobuster
  • Inspect website source code to discover backend S3 buckets
  • Read S3 bucket policies with get-bucket-policy to identify accessible objects
  • Exfiltrate objects from a bucket that denies listing by referencing known file names
  • Generate an Office document hash with office2john and crack it using hashcat mode 9600
  • Reuse recovered credentials to access a hidden CRM and expose customer PII
Real-world context

In cloud-centric environments, poorly configured resource policies can inadvertently expose sensitive data even without list permissions. Weak passwords on exposed files and secrets stored in spreadsheets remain common causes of real-world breaches.

KEY TAKEAWAY

A bucket policy is an access control decision written in JSON, and the most common mistake is granting a broad principal rather than a broad action. A policy that allows any principal to read the bucket makes its contents public regardless of every other setting in the account.

What this lab covers

You enumerate a web application for content that was not meant to be discoverable, follow it to storage behind the application, and recover documents whose protection turns out to be weaker than assumed.

The lab links two things that are usually taught separately: ordinary web content discovery, and cloud resource policy. Real assessments move between them constantly, because the path into cloud storage is very often a web server that references it.

It assumes no prior AWS knowledge and is a good introduction to reading resource policies, which is a distinct skill from reading identity policies.

How weak bucket policies expose data

S3 access is decided by the combination of identity policies, bucket policies, access control lists and account-level public access settings. A bucket policy is attached to the bucket itself and states which principals may perform which actions against which objects.

The dangerous pattern is a policy whose principal element is a wildcard. That grants the stated actions to anyone, authenticated or not. It is usually introduced deliberately to make something work, such as serving assets to a website, and then applied more broadly than intended because scoping it to specific prefixes takes more thought.

Discovery does not require guesswork when a web application references the bucket. Content discovery against the application surfaces paths, and those paths reveal the storage behind it. From there, listing permissions determine whether an attacker sees one referenced file or the entire inventory, which is why the list action deserves separate consideration from the read action.

How to detect this in your own environment

Enable S3 data events on buckets holding anything sensitive. Without them, object reads are invisible, and you will be able to establish that a bucket was public but not what was taken from it. This is the single most common gap in S3 incident response.

Alert on bucket policy changes, which are management events recorded by default. A policy modification that introduces a wildcard principal should page someone, because the window between misconfiguration and discovery by automated scanners is short.

Use continuous configuration checks rather than periodic audits. Public bucket exposure is discovered by attackers through constant scanning, so a monthly review is not a comparable cadence.

How to prevent it

Turn on block public access at the account level. It overrides bucket policies and access control lists, which makes it the one control that holds even when someone writes a permissive policy by mistake.

Separate listing from reading. Many exposures become serious because the attacker can enumerate the bucket rather than merely fetch a known object, and applications almost never need the list permission to function.

Serve public content through a distribution layer with an origin access identity rather than exposing the bucket directly. The bucket stays private, the content stays available, and the failure mode is a broken image rather than a data breach.

Real-world context

Publicly readable object storage has been behind a long series of disclosed data exposures across many organizations and providers, and it remains a standard finding in external assessments. The recurring cause is not a subtle flaw but a policy written to make something work quickly.

What makes it consequential is discoverability. Object storage is enumerable at internet scale, and automated scanning for readable buckets runs continuously, so an exposure created at any time is likely to be found by someone regardless of how obscure the name is.

The pattern maps to MITRE ATT&CK T1530 Data from Cloud Storage Object and, where recovered documents contain credentials, T1552.001 Credentials In Files.

Applying this at work

  • Enable account-level block public access everywhere it is not deliberately and documented as required.
  • Review bucket policies for wildcard principals, and check whether the list action is granted where only read is needed.
  • Enable S3 data events on buckets containing regulated or sensitive data so reads are attributable.
  • Add an alert on bucket policy modification introducing a public grant.
  • Move public asset delivery behind a distribution layer so buckets are never directly addressable.

Frequently asked questions

What makes a bucket policy weak?

Most often a wildcard in the principal element, which grants the stated actions to anyone. Broad actions matter too, but a narrow action granted to everyone is usually worse than a broad action granted to one named role.

Does block public access override a bucket policy?

Yes. Account-level block public access takes precedence over bucket policies and access control lists, which is why it is the most reliable single control against accidental exposure.

Why does the list permission matter separately?

Reading requires knowing an object key. Listing reveals every key in the bucket. Granting list turns a narrow exposure into a full inventory, and most applications do not need it.

Do I need my own AWS account to practice this?

No. The lab runs in a live AWS environment that Pwned Labs provisions for you, so there is nothing to set up and no risk to your own infrastructure.

Which certification covers this in depth?

The Amazon Cloud Red Team Professional (ACRTP) covers AWS data exposure, resource policies and privilege escalation in full, and is assessed hands-on in a live AWS account.

platform mock(1)

Cloud Security Training To Protect Your Business

Pwned Labs for Business gives your team access to dedicated business content, including labs and cyber ranges.

We also offer in-person or remote workshops, and our cloud penetration services are helping businesses become more secure!