One statement that made a bucket public
Read an S3 bucket policy with the AWS CLI and jq. Find the statement that allows anyone to read objects, the prefix it exposes, and the account settings that failed to stop it.
What you’re looking at
Read an S3 bucket policy with the AWS CLI and jq. Find the statement that allows anyone to read objects, the prefix it exposes, and the account settings that failed to stop it.
Your goal: Find the bucket policy statement that made exported files public, and the safety switches that were off.
- Briefing
- the story: what happened and what evidence you were handed.
- Terminal
- the dark box. It is a pretend Linux shell that runs in your browser. Type a command and press Enter. Nothing you type touches a real system.
- Walkthrough
- the numbered path. Each step says what to type and what you should see. Hints open one at a time.
- Answer boxes
- under each question step. Type what you found and press Check.
Words you will meet
- S3
- Amazon Simple Storage Service, cloud file storage in buckets
- AWS
- Amazon Web Services
- CLI
- command-line interface
- JSON
- JavaScript Object Notation, a text format of fields and values
Start with step 1 in the walkthrough. Every step says what to do and what you should see. The whole thing takes about 2 min to talk through.
Briefing
A customer found a link to a file in nw-shop-exports that opened without signing in. You have read-only AWS CLI access in the account.
get-bucket-policy returns the policy as a JSON string inside JSON, so pipe it through jq -r .Policy and then jq again. A Principal of "*" with Effect Allow means anyone on the internet, unless Block Public Access stops it.
cloud-shell · Cloud CLI review
Type help for the command list and objectives for your tasks. Everything runs in this browser.
Up and down arrows walk your history. Ctrl+L clears the screen. Try help, ls, and objectives.
The whole walkthrough
Every step in order, written to be read aloud: 289 words, about 2 min. It gives away every answer, so try the steps first.