Skip to content
Misconfiguration Write-up Beginner

From AWS S3 Misconfiguration to Sensitive Data Exposure

An AWS S3 bucket used for storing user files was misconfigured to allow public listing of its contents. An attacker could list folders and access sensitive files such as resumes containing personal data.

Jadek Mark Follow

Published on infosecwriteups.com

Often companies deploy third-party applications to store various media content. This content is usually in various file formats such as images, documents, Html, JavaScript, SQL.

Mase289, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

Many companies deploy third-party applications to store media content: images, documents, HTML, JavaScript, SQL and so on. During bug bounty engagements it is not unusual to find references to Amazon AWS S3 buckets disclosed in places such as the website source code, or through a particular operation such as a file upload. A response like the following, returned while uploading a file, hands the bucket name to anyone watching:

HTTP
200 OK“Successfully uploaded to s3://testbucket/profilepicures/user/fancy_avatar.jpg”

Buckets can also be found with the Google dork site:s3.amazonaws.com combined with target.com. Cloud storage is frequently misconfigured during deployment, and this write-up describes one such target.

The target was a platform that linked job seekers to recruiters and ensured that candidates for various jobs were correctly placed and matched with available job opportunities. Two features touched S3: uploading a profile picture, which was saved to a bucket and loaded from there whenever the file was accessed, and a feature that let the end user upload, view and update their Curriculum Vitae. Both actions revealed the URL of the S3 bucket.

Photo by Markus Spiske on Unsplash From the original on infosecwriteups.com

Setup

The tool the researcher describes using for the bucket testing is the Amazon AWS S3 CLI, a command-line utility anybody can use to perform operations on an S3 bucket, including the creation, deletion, uploading and synchronisation of buckets, folders and objects within the bucket. No account, role or credential setup is described. The precondition was simply knowing the bucket URL, which the application itself disclosed through its upload features.

Finding it

Testing for the typical OWASP bug classes on this target resulted in none being discovered; the target was hardened for the most part. The interesting behaviour came from the upload features. Uploading a profile picture saved the file to an S3 bucket and loaded it from there whenever the file was accessed, and the CV upload, view and update feature did the same. Performing these actions revealed the bucket URL:

Text
s3://vulnerable-bucket.s3-ap-southeast-1.amazonaws.com/

The researcher noted this URL, to which both CVs and profile pictures got uploaded, and continued testing. It was only much later that the AWS S3 CLI was launched against it.

Exploitation

Step 1: try to write to the bucket

A simple text file containing the researcher's identifier alias was created, and a copy was attempted:

Bash
aws s3 cp test.txt s3://vulnerable-bucket

This returned an Access Denied error. A move was attempted next:

Bash
aws s3 mv test.txt s3://vulnerable-bucket

This also returned Access Denied. The access control settings were properly restricting copy and move operations on the bucket.

Step 2: try to list the bucket

The researcher then attempted a list operation to check whether that was restricted as well. It was not. The following folder structure was returned, and to the researcher's surprise it included sensitive folders containing both company and user data:

Text
 PRE JD_2.0/ PRE candidatebulkupload/ PRE candidatefiles/ PRE companylogo/ PRE feed/ PRE marketmapresumes/ PRE medias/ PRE parsed_resumes/ PRE printableprofiles/ PRE production-logs/ PRE profilepic/ PRE metrics/ PRE resume/ PRE resumes/ PRE uploads/ PRE whatsapp/

Step 3: read the objects

The researcher went through the folders assumed to be the most sensitive to determine whether the files themselves, and not just the directory and file structure, could be accessed. The resumes folder was of particular interest since it contained every single resume belonging to users that had uploaded them to the web application. The resumes revealed personal details typical of such a document: full names, dates of birth, geographical location, hobbies among other details.

After confirming this, testing stopped and a report was submitted to the affected program, which was quick to respond and implement a fix.

The write-up also records a tip for downloading an object for further analysis:

Bash
aws s3 cp s3://test-bucket/file.txt ./

This copies a file contained within the bucket to the current working directory.

Root cause

Amazon S3 access control lists (ACLs) enable you to manage access to buckets and objects. Each bucket and object has an ACL attached to it as a subresource, and it defines which AWS accounts or groups are granted access and the type of access. On this bucket write operations returned Access Denied, while listing and reading were not restricted. The bucket was therefore open for the operations that mattered most, and the application's own upload features published its URL to any user. The report does not state which ACL grant or bucket policy produced this state.

Impact

The exposed folders contained both company and user data, including every resume uploaded to the application, with the personal details those documents carry. The contents of the bucket dated way back to the inception of the company, so the impact could have been devastating. It is unclear how long the bucket was left open to the public, so unauthorised access could already have been obtained before this discovery. The report does not say how many users or records were affected.

Fix

The affected program responded quickly and implemented a fix.

Variants to test

  1. Upload a profile picture or document and inspect the response and the resulting object URL for a bucket name, as in the 200 OK example above. A positive result is a bucket hostname or s3:// path disclosed by the application.
  2. Run the Google dork site:s3.amazonaws.com with the target domain. A positive result is a bucket belonging to the target that responds to requests.
  3. Try a write with aws s3 cp test.txt s3://test-bucket. Access Denied here does not mean the bucket is safe; continue to the next step.
  4. Try a list with aws s3 ls s3://test-bucket and aws s3 ls s3://test-bucket/test-folder/. A positive result is a folder listing such as the PRE entries above, especially folders with names suggesting user uploads, resumes, logs or metrics.
  5. Try to read an object from a listed folder with aws s3 cp s3://test-bucket/file.txt ./. A positive result is the file being downloaded to the current working directory.
  6. Try the move and delete operations, aws s3 mv test.txt s3://test-bucket and aws s3 rm s3://test-bucket/test.txt, to map exactly which permissions the ACL grants. A positive result is a successful move or deletion, which turns a read exposure into data tampering or destruction.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

A security researcher was testing a job website, the kind of site where people looking for work upload their CV and recruiters look for candidates. The site looked well built: the usual checks for common web bugs found nothing. But the site stored files in a cloud storage service called Amazon S3, and that storage was set up in a way that let the researcher browse it and download what was inside. The files included the CVs of users, with names, dates of birth, locations and hobbies. The researcher reported it, the company fixed it quickly, and this article walks through the whole thing slowly, assuming you have never done security testing before.

Photo by Markus Spiske on Unsplash From the original on infosecwriteups.com

The background: what S3 is and why it matters

Many companies do not keep uploaded files on their own web servers. Instead they rent storage from a cloud provider. Amazon S3 (Simple Storage Service) is the most common choice. Think of S3 as a huge public locker room: each company rents one or more buckets (a bucket is just a named container, like a folder at the top level), and inside a bucket they put objects (files) organised into folders.

A bucket has a name, and every bucket lives in a region, which is a physical part of the world where Amazon keeps its computers. The bucket in this story is called vulnerable-bucket and lives in the ap-southeast-1 region (Singapore). Its address looks like this:

Text
s3://vulnerable-bucket.s3-ap-southeast-1.amazonaws.com/

Read that address piece by piece:

  • s3:// is the prefix that says "this is an S3 location", the same way https:// says "this is a web address".
  • vulnerable-bucket is the name the company chose for its bucket.
  • s3-ap-southeast-1.amazonaws.com is Amazon's address for the Singapore storage region.
  • The final / means the root of the bucket, the top-level folder.

When a bucket is set up correctly, only the company's own systems can read and write inside it. When it is set up carelessly, strangers can do things with it too. That careless setup is what this article is about.

How the bucket name leaked

Companies often reveal their bucket names without meaning to. The article mentions two common ways.

The first is through the website itself. When you upload a file, the site has to tell your browser where the file went, and that answer sometimes contains the bucket address. Here is an example response from an upload, as quoted in the article:

HTTP
200 OK“Successfully uploaded to s3://testbucket/profilepicures/user/fancy_avatar.jpg”

Line by line:

  • 200 OK is the standard web code for "everything went fine". Your browser receives it every time a page or file loads successfully.
  • The text in quotes is the message the server sent back. It says the file was saved to a bucket called testbucket, inside a folder called profilepicures (a typo for "profilepictures", which is common in real systems), then a folder called user, and finally the file name fancy_avatar.jpg.

Anyone who opens their browser's developer tools, or simply watches the network traffic while uploading a picture, can read that message. The bucket name is now known.

The second way is through Google. Search engines index public S3 buckets, so a search query can find them. The article calls this a Google dork, which just means a carefully crafted search query used to find something specific. The dork is:

Text
site:s3.amazonaws.com target.com

Line by line:

  • site:s3.amazonaws.com tells Google to return only results hosted on Amazon's S3 domain.
  • target.com is the company you are researching. Replace it with the real domain.

Together they ask Google: "show me pages on S3 that mention this company". If the company's bucket is public and indexed, it will appear in the results.

The target and the two features that leaked the bucket

The target was a platform that linked job seekers to recruiters, matching candidates with available jobs. Two features touched S3:

  1. Profile picture upload. When a user uploaded a picture, the site saved it to the bucket and loaded it from there whenever the picture was displayed.
  2. CV upload, view and update. Users could upload their Curriculum Vitae, look at it later, and replace it. Those files also went to the bucket.

Both features revealed the bucket URL. The researcher noted the address down and kept testing other things. It was only much later that the bucket itself was examined.

The tool: the AWS command line

To look inside a bucket you need a tool that speaks S3's language. Amazon provides one called the AWS CLI (command line interface). A command line is a text window where you type instructions instead of clicking buttons. The AWS CLI is free, anyone can install it, and it can create, delete, upload and synchronise buckets, folders and objects.

The article describes no account or credential setup at all. The only thing needed was the bucket address, which the website had already given away.

Step 1: can a stranger write into the bucket?

The first test was whether an outsider could put a file into the bucket. The researcher created a small text file named test.txt containing an alias, a nickname used to identify the tester without revealing their real name. Then they tried to copy the file into the bucket:

Bash
aws s3 cp test.txt s3://vulnerable-bucket

Line by line:

  • aws is the name of the command line program.
  • s3 says which part of Amazon's services you want, here the storage service.
  • cp means copy. It uploads a local file to a remote location, or downloads a remote file to your computer.
  • test.txt is the local file being sent.
  • s3://vulnerable-bucket is the destination, the root of the bucket.

The answer was Access Denied. That is the storage service saying "you are not allowed to do that". The researcher then tried to move the file instead of copying it:

Bash
aws s3 mv test.txt s3://vulnerable-bucket

Line by line:

  • mv means move. It uploads the file and then deletes the local copy, so the file ends up only in the bucket.
  • Everything else is the same as before.

This also returned Access Denied. So the bucket's permission settings were correctly blocking strangers from adding or moving files. That is good news, but it does not mean the bucket is safe. It only means one door is locked.

Step 2: can a stranger see what is inside?

Next the researcher tried to list the bucket, which means asking the storage service to show the names of the folders and files inside it. The command for that is:

Line by line:

  • ls means list, the same idea as the ls command on Linux or macOS that shows the files in a folder.
  • s3://vulnerable-bucket is the bucket to list.

This time there was no Access Denied. The bucket answered with its folder structure:

Text
 PRE JD_2.0/ PRE candidatebulkupload/ PRE candidatefiles/ PRE companylogo/ PRE feed/ PRE marketmapresumes/ PRE medias/ PRE parsed_resumes/ PRE printableprofiles/ PRE production-logs/ PRE profilepic/ PRE metrics/ PRE resume/ PRE resumes/ PRE uploads/ PRE whatsapp/

Line by line:

  • PRE stands for "prefix". In S3, folders are not real folders; they are just the beginning of file names. PRE resumes/ means "there are objects whose names start with resumes/".
  • JD_2.0/ probably holds job descriptions, version 2.0.
  • candidatebulkupload/ and candidatefiles/ suggest bulk uploads of candidate documents.
  • companylogo/ holds company logos.
  • feed/ and marketmapresumes/ are less obvious from the name alone.
  • medias/ holds general media.
  • parsed_resumes/ suggests CVs that have been processed by software to extract their contents.
  • printableprofiles/ suggests profile pages prepared for printing.
  • production-logs/ is a log folder, and logs often contain details about how a system runs.
  • profilepic/ holds profile pictures.
  • metrics/ holds measurements about the service.
  • resume/ and resumes/ hold CVs.
  • uploads/ is a general upload folder.
  • whatsapp/ suggests files exchanged through WhatsApp.

To a beginner, this list looks like a harmless set of folder names. To a security tester it is a map of the company's data. The names resumes, parsed_resumes, candidatefiles and production-logs all point at information that should never be public.

Step 3: can a stranger download the files?

Seeing folder names is one thing. The real question is whether the files inside can be downloaded. The researcher went through the folders that looked most sensitive, starting with resumes, because that folder held every CV uploaded by users of the site.

The answer was yes. The files could be downloaded, and the CVs contained the personal details you would expect in such a document: full names, dates of birth, geographical location, hobbies and more. At that point the researcher stopped testing and reported the problem to the company, which responded quickly and fixed it.

The article also gives a tip for downloading a single file so you can examine it on your own computer:

Bash
aws s3 cp s3://test-bucket/file.txt ./

Line by line:

  • cp is copy again, but this time the direction is reversed: the source is remote and the destination is local.
  • s3://test-bucket/file.txt is the file inside the bucket.
  • ./ means "the current folder", the folder your command line is sitting in. The file lands there.

This is useful when you want to open a file, check what it contains, or confirm that it really is what its name suggests.

Why this happened

S3 controls who can do what using access control lists, usually shortened to ACLs. An ACL is a list attached to a bucket or to an individual object that says which Amazon accounts or groups are allowed in, and what kind of access they get: read, write, and so on. Think of it as the guest list at a venue: the list decides who gets through the door and what they are allowed to do once inside.

On this bucket writing was blocked, because both the copy and the move attempts returned Access Denied. But listing and reading were not blocked. So the bucket was open to the public for exactly the two operations that matter most: seeing what is inside and taking copies of it. On top of that, the website's own upload features published the bucket address to every user.

The article does not say which specific ACL entry or bucket policy produced this state. What it does say is that the configuration was wrong.

How bad it could have been

The exposed folders held both company data and user data, including every CV uploaded to the application, with all the personal details those documents carry. The contents of the bucket dated back to the company's earliest days. The article calls the potential impact devastating.

It is also unclear how long the bucket had been open to the public. Someone else could have found it and downloaded files before this researcher did, and nobody would know. The article does not say how many users or records were affected.

The fix

The company responded quickly and implemented a fix. The article does not describe what change was made.

What to try yourself, in order

If you want to practise this kind of check on a target you are authorised to test, the article lays out a sequence. Each step tells you what a positive result looks like.

  1. Upload a profile picture or a document on the site, then look at the response and at the address of the resulting file. A positive result is a bucket hostname or an s3:// path appearing in either place, as in the 200 OK example earlier.
  2. Run the Google dork site:s3.amazonaws.com together with the target domain. A positive result is a bucket belonging to the target that answers requests.
  3. Try a write with aws s3 cp test.txt s3://test-bucket. Access Denied here does not mean the bucket is safe, so carry on to the next step.
  4. Try to list with aws s3 ls s3://test-bucket and aws s3 ls s3://test-bucket/test-folder/. A positive result is a folder listing like the PRE entries above, especially folders whose names suggest user uploads, resumes, logs or metrics.
  5. Try to read a file from a listed folder with aws s3 cp s3://test-bucket/file.txt ./. A positive result is the file arriving in your current folder.
  6. Try the move and delete operations, aws s3 mv test.txt s3://test-bucket and aws s3 rm s3://test-bucket/test.txt, to map exactly which permissions the ACL grants. A positive result is a successful move or deletion, which turns a read exposure into data tampering or destruction.

Step 6 deserves a warning. Deleting or moving files changes or destroys real data. Only ever do it on a target where you have explicit permission, and stop as soon as you have confirmed the permission exists.

Glossary

  • Access Denied: the message a storage service returns when your request is not permitted by its permission settings.
  • ACL (access control list): a list attached to a bucket or object saying which accounts or groups may access it and what they may do.
  • AWS CLI: Amazon's command line tool for working with its services, including S3, from a text window.
  • Bucket: a named container in Amazon S3 that holds files, similar to a top-level folder.
  • Bug bounty program: a scheme where a company invites outside researchers to report security problems, usually with a reward.
  • Command line: a text interface where you type instructions instead of clicking buttons.
  • CV (Curriculum Vitae): a document listing a person's education, work history and personal details, used when applying for jobs.
  • Google dork: a carefully crafted search query used to find specific information, such as public storage buckets.
  • Object: a single file stored in an S3 bucket.
  • OWASP: an organisation that publishes widely used guidance on common web security problems; "OWASP bug classes" means those well-known categories of bug.
  • Prefix (PRE): in an S3 listing, the start of object names that acts like a folder name.
  • Region: the physical part of the world where a cloud provider keeps its computers, such as ap-southeast-1 for Singapore.
  • S3 (Simple Storage Service): Amazon's cloud storage service for files.
  • s3://: the address prefix that identifies a location in Amazon S3.
  • Source code: the human-written instructions that make up a website or application.
  • Subresource: an extra piece of configuration attached to a bucket or object, such as its ACL.
  • URL: the address of something on the internet, such as a web page or a file.

More by Jadek Mark

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.