Labs / Cloud Security / Data left in the open: buckets, keys & code

Lab 1 of 3 · Data left in the open: buckets, keys & code

The bucket that answered to everyone

A customer-data bucket left public beside the one that should be, found and locked from the outside.

Start this lab 5 steps

The idea

Corinne runs the platform at Lodestar Maps, a small firm that serves map tiles to its customers' websites. The tiles live in cloud object storage, in a bucket that is meant to be public: anyone's browser has to fetch them. This morning a customer emailed: a second Lodestar bucket, full of customer records, also answers without a login.

You are at Corinne's desk with the aws command-line tool and no credentials, the same view anyone on the internet has. Confirm the tip from the outside, find the one setting that makes a bucket answer strangers, turn it off, and prove the fix from the outside.

A request with no key
A request with no key
It should refuse, and it answers
It should refuse, and it answers
First the names, then the contents
First the names, then the contents
One flag, two buckets
One flag, two buckets
Checked on every request
Checked on every request

Steps

  1. Public on purpose

    Cloud object storage keeps files in buckets. Every request goes to one address, the storage endpoint, and names the bucket it wants. A bucket is private by default: a request with no valid credentials (no access key proving who is asking) is refused. Lodestar's map tiles are the exception: a browser loading a customer's map has no Lodestar login, so the tiles bucket is deliberately marked public.

    You are on operator, a machine with the aws tool and no keys set up. Point it at Lodestar's endpoint with --endpoint-url (here api, at 10.0.1.20) and list the tiles bucket with --no-sign-request, the flag that tells aws to send no credentials at all, as a stranger would.

    operator:~# aws --endpoint-url http://10.0.1.20 s3 ls s3://lodestar-tiles --no-sign-request
  2. The bucket that should not answer

    The customer's tip named a different bucket: lodestar-exports, where Lodestar drops its quarterly customer extracts. Nothing on a public website ever needs it, so it should be private: a stranger's unsigned request should be refused. Run the same anonymous listing against it and see.

    operator:~# aws --endpoint-url http://10.0.1.20 s3 ls s3://lodestar-exports --no-sign-request
  3. Read what leaked

    A listing is bad; a read is worse. The same --no-sign-request that listed the bucket will download an object from it. Copy the export to your screen (cp <object> - writes it to standard output) and see exactly what a stranger could take.

    One honest note before you do: reading data from a system whose owner has not authorised you in writing is unauthorised access, public bucket or not. It is lawful here only because this bucket is Lodestar's own, which is Corinne's to inspect.

    operator:~# aws --endpoint-url http://10.0.1.20 s3 cp s3://lodestar-exports/customers-2026-q1.csv - --no-sign-request
  4. Why it answers

    Why does one bucket answer strangers and another not? In a real cloud, a bucket is anonymously readable only when something explicitly opens it: a bucket policy that grants public read, or per-object access lists (ACLs) set to public, with the account's "block public access" guard switched off. This lab folds all of that into one setting: each bucket in Lodestar's account config carries a public flag, and the endpoint reads it on every request. You are on api now: the box that serves the config, not the outsider's operator. Look at the config with jq, which pretty-prints the buckets section of the file.

    Read the two entries side by side. lodestar-tiles is "public": true on purpose: the map widget needs it. lodestar-exports is "public": true by mistake: nothing needs it, and it holds customer data. The fix is not to delete the file or move it; it is to turn that one flag off for the bucket that should never have carried it.

    api:~# jq .buckets /opt/cloud/seeds/bucket-exposure.json
  5. Lock it, and prove it from outside

    Make lodestar-exports private. Write the account config back with its public flag set to false, leaving the tiles bucket untouched: a real fix never breaks the thing that was meant to work. The endpoint re-reads the config the moment the file changes, so no restart is needed.

    Then do the only test that matters: run the attacker's own command again, from operator, with no credentials. The exports bucket must now refuse you, and the tiles bucket must still serve.

    operator:~# aws --endpoint-url http://10.0.1.20 s3 ls s3://lodestar-exports --no-sign-request
    operator:~# aws --endpoint-url http://10.0.1.20 s3 ls s3://lodestar-tiles --no-sign-request

Run these steps on real machines

Keep reading

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab