Skip to content
Path traversal Write-up Intermediate

Starbucks Path Traversal: Nearly 100M Customer Records

A proxy API took an item ID from the URL and inserted it into an internal request path, allowing path traversal to reach an internal search service. An attacker could access names, emails, phone numbers and addresses of nearly 100 million customers without authentication.

medium.com

Published on medium.com

Bug Bounty

Muhammad Asim Shahzad, on medium.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

The target was the Starbucks web application, which used a backend-for-frontend (BFF) layer. Browser requests hit a proxy on the public host, and that proxy fetched the real data from an internal service the browser never talks to directly. Most proxied calls were fixed routes. One route took an item ID from the URL and inserted it into the internal request path, and that route is where the bug lived.

AI-generated illustration From the original on medium.com

The illustration above is AI-generated and accompanies the write-up; it does not show any part of the target.

The case is a 2020 disclosure by Sam Curry, with Justin Gardner and Noah Pearson credited. Starbucks patched it the next day and paid a $4,000 bounty. The write-up is an analytical case study of that public disclosure, and it deliberately omits reproduction details.

Setup

The report does not describe accounts, roles, tools or versions. What it does establish is the precondition that matters: the attacker only needs a browser. No special account was required to reach the data described in the impact section.

Finding it

The starting observation is structural. In a BFF proxy, user input that becomes part of a path on a second, hidden server is a traversal candidate: traversal sequences start walking that server's directory tree instead of the public one. The interesting route took an item ID from the URL and dropped it into the internal request path.

A WAF blocked the obvious pattern, but a backslash-based variant slipped past it. Error codes then did the mapping. The JSON "not found" style of response proved requests were reaching the internal API, and a switch to "bad request" marked its root.

Exploitation

Step 1: Bypass the WAF with a backslash variant

The obvious traversal pattern was blocked. A backslash-based variant of the same input was not, and it reached the internal service. The report does not reproduce the exact payload.

Step 2: Map the internal service through error shapes

With requests landing internally, the response shape told the researchers where a request had arrived. A JSON "not found" style response meant the request had reached the internal API. A switch to "bad request" marked the root of that API. This gave a way to walk the internal surface without seeing it directly.

Step 3: Enumerate top-level services

From there, Curry and Justin Gardner enumerated top-level services on the internal host.

Step 4: Query the search API

One of those services was a search API over production accounts and addresses, which the researcher identifies as a Microsoft Graph instance. A count query returned nearly 100 million records, and filter parameters could target a single user. The report does not include the requests themselves.

Root cause

The mistake is that user input became part of a path on a second, hidden server. The proxy took an item ID from the URL and inserted it into the internal request path without constraining it to a single segment, so traversal sequences moved the request around the internal service's directory tree rather than the public one.

The existing defence, a WAF, did not stop it because it matched the obvious pattern and missed a backslash-based variant. The write-up's own analysis is that internal services should enforce per-user authorisation rather than trust that a request came from the BFF.

Impact

Anyone with a browser could have pulled names, emails, phone numbers and addresses for close to 100 million customers, with no special account. Filter parameters allowed targeting a single user. The researchers also listed internal services for loyalty, cards, rewards and billing, which they did not test. Data at this scale is phishing and fraud fuel.

Fix

Starbucks patched the issue the next day. The write-up sets out what a proxy of this kind should do:

  1. Never build internal paths from raw input. Validate IDs against a strict format, then URL-encode them as a single segment.
  2. Normalise, then allow-list. Resolve the final internal path and reject anything outside the route you meant to call.
  3. Give the proxy a narrow identity. Internal services should enforce per-user authorisation, not trust that a request came from the BFF.
  4. Do not lean on the WAF. Traversal has too many encodings.

The write-up includes this reference implementation, which is its own code rather than code from the target:

Python
import re
from urllib.parse import quote
Python
ITEM_ID = re.compile(r"^[A-Za-z0-9-]{8,64}$")
ALLOWED_PREFIX = "/stream/v1/users/{uid}/items/"

def proxy_get_item(session, item_id):
    if not ITEM_ID.fullmatch(item_id):           # rejects dots, slashes, backslashes
        return Fail(400)

    prefix = ALLOWED_PREFIX.format(uid=session.user_id)
    path = prefix + quote(item_id, safe="")      # one encoded segment, never a path

    if not normalise(path).startswith(prefix):   # defence in depth
        return Fail(400)

    # Internal service re-checks that the item belongs to session.user_id
    return internal.get(path, on_behalf_of=session.user_id)

# Test: IDs containing ../, ..\, %2e%2e or %5c must return 400 and never reach internal.get

The pattern rejects dots, slashes and backslashes; quote with an empty safe set keeps the ID to one encoded segment; the prefix check is defence in depth; and the internal service re-checks ownership. The comment at the end gives the test cases: IDs containing ../, ..\, %2e%2e or %5c must return 400 and never reach internal.get.

Variants to test

  • Encoding variants against the WAF. Send the same traversal with backslashes, double encoding and mixed separators. A positive result is a response that differs from the WAF block page and matches the internal service's error shape.
  • Error-shape mapping. Compare responses for paths that do not exist, paths at the root and paths that reach a service. A positive result is a distinguishable "not found" versus "bad request" pattern that lets you infer where a request landed.
  • Top-level service enumeration. Walk the internal host's top-level names once you can reach it. A positive result is a service that answers with data rather than an error.
  • Search and filter endpoints. Look for count queries and filter parameters on any search service you reach. A positive result is a count that reflects production records and a filter that narrows to one user.
  • Proxy identity trust. Check whether internal services enforce per-user authorisation or accept anything arriving from the BFF. A positive result is data returned for a user the session does not own.

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. 17 min read.

What happened, in plain words

In 2020, a security researcher named Sam Curry found a way to make the Starbucks website hand over data about nearly 100 million customer accounts. He did not break into a server, guess a password or steal anything from a user's computer. He used a user-controlled path segment in the Starbucks website, and the proxy passed it along to a hidden internal computer that the browser never talks to directly.

The hidden computer held a search service over real customer records: names, email addresses, phone numbers and home addresses. The hidden computer answered the request. Starbucks fixed the problem the next day and paid a $4,000 bounty, which is a reward a company pays someone who reports a security flaw responsibly.

This article walks through what happened, step by step, in the same order as the technical write-up, and explains every term from scratch. It is a study of a public disclosure, not a new discovery, and it deliberately leaves out the exact details needed to repeat the attack.

AI-generated illustration From the original on medium.com

The image above is an AI-generated illustration that accompanies the write-up. It does not show any part of the Starbucks website or the attack itself.

The pieces you need to understand first

Before the story makes sense, here are the building blocks, explained as if you have never heard of them.

A web server and a browser. Your browser (Chrome, Firefox, Safari) asks a website for pages and data. The website's computer, called a server, answers. Normally the browser talks only to the public server, the one whose address you see in the address bar.

An API. Think of an API as a waiter in a restaurant. You do not walk into the kitchen yourself; you tell the waiter what you want, and the waiter brings it from the kitchen. In software, an API is a defined way for one program to ask another program for data or to do something. The browser asks the public server, and the public server asks other computers behind the scenes.

A backend-for-frontend (BFF) proxy. A proxy is a middleman. A BFF is a specific kind of middleman: a layer that sits between the browser and the company's internal services. The browser talks to the proxy on the public host, and the proxy fetches the real data from an internal service that the browser never talks to directly. The everyday comparison is a receptionist at an office. Visitors speak to the receptionist at the front desk, and the receptionist walks to the back offices to fetch what is needed. Visitors never wander the corridors themselves.

An internal service. This is a computer or program inside the company's network that only other company systems are supposed to reach. In the receptionist comparison, it is the back office. It holds data and answers requests, but it should never be directly reachable from the street.

A path. When you visit a website, the part after the domain name is the path. In https://example.com/shop/items/12345, the path is /shop/items/12345. Servers use paths like folders on your computer to decide which file or piece of data to return.

Path traversal. This is the vulnerability class at the heart of the story. A path traversal happens when a program takes a piece of text from the user and glues it into a file or folder path without checking it. If the user supplies ../, which means "go up one folder" on almost every operating system, the program can be tricked into reading something outside the intended folder. The everyday comparison is a form that asks for your name and then files your paper in a cabinet drawer labelled with that name. If you write "../../payroll" as your name, the clerk files your paper in the payroll drawer instead of the visitor drawer. The clerk followed instructions; the instructions were never checked.

A WAF (web application firewall). A WAF is a filter that sits in front of a website and inspects incoming requests, blocking ones that look like known attacks. The everyday comparison is a bouncer at a door with a list of banned faces. A bouncer only stops the faces on the list; a clever disguise gets past.

URL encoding. Some characters cannot appear literally in a web address, so they are written in a code. A dot becomes %2e, a forward slash becomes %2f, and a backslash becomes %5c. The server decodes these back into the real characters before using them. This matters because an attacker can write the same character in several ways, and a filter that only checks one spelling will miss the others.

A backslash. On Windows computers, folders are separated with a backslash \ rather than a forward slash /. A traversal written with backslashes, like ..\, does the same job as ../ on a Windows machine. Many filters only look for the forward-slash version.

HTTP status codes. When a server answers, it includes a number that says how it went. 200 means success. 400 means bad request, the server did not understand or accept what was sent. 404 means not found, the thing asked for does not exist. These numbers are like the labels a courier puts on a parcel: delivered, address unknown, refused.

JSON. JSON is a common text format for data, made of names and values in curly braces, for example {"error": "not found"}. Many APIs answer with JSON, and the shape of that JSON can tell you which system replied.

A count query. A count query asks a database "how many records match?" without returning the records themselves. It is a quick way to measure how much data sits behind a service.

A filter parameter. A filter is a part of a request that narrows results, for example "only records for this one user". If a filter works on a search service, an attacker can pick out a single person's data.

Microsoft Graph. Microsoft Graph is Microsoft's API for accessing data and services in the Microsoft cloud. The researcher identifies the internal search service as a Microsoft Graph instance, meaning it was built on that technology.

A bounty. A bug bounty is a reward a company pays to someone who finds and reports a security problem instead of exploiting it. Here it was $4,000.

CWE and CVE. CWE is a catalogue of weakness types, like a dictionary of known kinds of mistakes. CVE is a catalogue of specific, individually numbered vulnerabilities. The write-up maps this bug to CWE-22 (path traversal), CWE-441 (unintended proxy or intermediary) and CWE-284 (improper access control), and notes that no CVE was reported. Those mappings are the write-up's own analysis, not something taken from the original disclosure.

The setup: what the attacker needed

The report does not describe accounts, roles, tools or software versions. What it does establish is the one precondition that matters: the attacker only needed a browser. No special account was required to reach the data described in the impact section. That is worth pausing on. Many attacks require a login, a stolen password or a piece of software installed on the victim's machine. This one required the same thing you use to read the news.

Finding it: the structural clue

The starting observation is about structure, not about a specific trick. In a BFF proxy, any user input that becomes part of a path on a second, hidden server is a traversal candidate. Why? Because traversal sequences like ../ start walking that hidden server's directory tree instead of the public one. The receptionist takes your note, walks to the back office, and reads your note as a filing instruction.

Most proxied calls were fixed routes, meaning the proxy always asked the internal service for the same kind of thing, with no user input in the path. Those are safe by construction. The interesting route took an item ID from the URL and dropped it into the internal request path. An item ID is meant to be a short identifier, like a product code. If the proxy pastes that identifier straight into the internal path, the identifier is no longer just an identifier; it is an instruction about where to look.

A WAF blocked the obvious pattern, the plain ../ style traversal. But a backslash-based variant slipped past it. Error codes then did the mapping. The JSON "not found" style of response proved requests were reaching the internal API, and a switch to "bad request" marked its root. In other words, the researchers could not see the hidden server, but they could watch how it answered, and the answers told them where their requests had landed.

Exploitation, step by step

Step 1: Bypass the WAF with a backslash variant

The obvious traversal pattern was blocked. A backslash-based variant of the same input was not, and it reached the internal service. The report does not reproduce the exact payload.

A backslash-based variant slipped past the WAF that blocked the obvious pattern. The bouncer checked for one disguise and missed another. This is a general lesson: a filter that blocks one spelling of an attack is not a defence, it is a speed bump.

Step 2: Map the internal service through error shapes

With requests landing internally, the response shape told the researchers where a request had arrived. A JSON "not found" style response meant the request had reached the internal API. A switch to "bad request" marked the root of that API. This gave a way to walk the internal surface without seeing it directly.

Think of it as tapping on walls in the dark. You cannot see the corridor, but a hollow sound tells you there is a room, and a solid sound tells you there is a wall. The status codes and JSON bodies were the sounds. A 404-style JSON answer meant "you are inside the building, but that room does not exist". A 400 answer meant "you are at the front door and your request is malformed". By sending requests and reading which answer came back, the researchers built a mental map of a system they could not see.

Step 3: Enumerate top-level services

From there, Curry and Justin Gardner enumerated top-level services on the internal host. To enumerate means to list things one by one. The internal host is like an office building with many departments: search, loyalty, cards, rewards, billing. The researchers walked the top-level names, asking for each in turn, and noted which ones answered.

Step 4: Query the search API

One of those services was a search API over production accounts and addresses, which the researcher identifies as a Microsoft Graph instance. Production means the real, live data, not a test copy. A count query returned nearly 100 million records, and filter parameters could target a single user. The report does not include the requests themselves.

Why does the count matter? Because it turns a guess into a measurement. Before the count, the researchers knew they had reached a search service. After it, they knew the service held close to 100 million records. And because filter parameters worked, they could have narrowed the results to one person.

Root cause: why it worked

The mistake is simple to state: user input became part of a path on a second, hidden server. The proxy took an item ID from the URL and inserted it into the internal request path without constraining it to a single segment. A segment is one piece of a path between slashes. If the item ID is forced to be a single segment, it cannot contain a slash or a backslash, and it cannot climb folders. Because it was not constrained, traversal sequences moved the request around the internal service's directory tree rather than the public one.

The existing defence, a WAF, did not stop it because it matched the obvious pattern and missed a backslash-based variant. The write-up's own analysis is that internal services should enforce per-user authorisation rather than trust that a request came from the BFF. In plain terms, the back office believed anyone who arrived through the reception desk, without checking whether that visitor was allowed to see the file they asked for.

Impact: what could have happened

Anyone with a browser could have pulled names, email addresses, phone numbers and addresses for close to 100 million customers, with no special account. Filter parameters allowed targeting a single user. The researchers also listed internal services for loyalty, cards, rewards and billing, which they did not test. Data at this scale is phishing and fraud fuel.

Phishing is a scam where someone uses real details about you, like your name and email address, to make a fake message convincing. Fraud is the misuse of that data, for example to open accounts or take over existing ones. A list of names, emails, phone numbers and addresses is exactly the raw material for both.

The fix

Starbucks patched the issue the next day. The write-up sets out what a proxy of this kind should do:

  1. Never build internal paths from raw input. Validate IDs against a strict format, then URL-encode them as a single segment.
  2. Normalise, then allow-list. Resolve the final internal path and reject anything outside the route you meant to call.
  3. Give the proxy a narrow identity. Internal services should enforce per-user authorisation, not trust that a request came from the BFF.
  4. Do not lean on the WAF. Traversal has too many encodings.

To unpack those four points. First, an item ID should be checked against a strict pattern, for example only letters, digits and hyphens of a certain length, and then encoded so it can never be read as a path. Second, normalise means to simplify a path into its final, unambiguous form, resolving every .. and .; after that, check the result against a list of allowed routes and reject anything else. Third, the internal service should check who the user is on every request, rather than assuming that anything arriving from the proxy is trustworthy. Fourth, a WAF is a useful extra layer but not a primary defence, because there are too many ways to spell the same traversal.

The write-up includes this reference implementation, which is its own code rather than code from the target:

Python
import re
from urllib.parse import quote

Line by line: import re loads Python's regular expression module, which is a tool for matching text against a pattern. from urllib.parse import quote loads a function called quote that turns special characters into their URL-encoded form, so a value can be placed safely inside a web address.

Python
ITEM_ID = re.compile(r"^[A-Za-z0-9-]{8,64}$")
ALLOWED_PREFIX = "/stream/v1/users/{uid}/items/"

def proxy_get_item(session, item_id):
    if not ITEM_ID.fullmatch(item_id):           # rejects dots, slashes, backslashes
        return Fail(400)

    prefix = ALLOWED_PREFIX.format(uid=session.user_id)
    path = prefix + quote(item_id, safe="")      # one encoded segment, never a path

    if not normalise(path).startswith(prefix):   # defence in depth
        return Fail(400)

    # Internal service re-checks that the item belongs to session.user_id
    return internal.get(path, on_behalf_of=session.user_id)

# Test: IDs containing ../, ..\, %2e%2e or %5c must return 400 and never reach internal.get

Line by line. ITEM_ID = re.compile(r"^[A-Za-z0-9-]{8,64}$") builds a pattern that accepts only 8 to 64 characters, each of which must be a letter, a digit or a hyphen. The ^ and $ anchor the pattern to the whole string, so a value cannot sneak extra characters on either end. ALLOWED_PREFIX = "/stream/v1/users/{uid}/items/" stores the one route the proxy is allowed to call, with a placeholder for the user's identifier.

def proxy_get_item(session, item_id): defines the function that handles a request, taking the user's session and the item ID from the URL. if not ITEM_ID.fullmatch(item_id): checks the whole item ID against the pattern. If it does not match, the comment notes that this rejects dots, slashes and backslashes, which are exactly the characters a traversal needs. return Fail(400) then refuses the request with a bad request status.

prefix = ALLOWED_PREFIX.format(uid=session.user_id) fills in the current user's identifier, so the path is scoped to that user's own items. path = prefix + quote(item_id, safe="") appends the item ID after encoding it with an empty safe set, meaning every special character is encoded and the ID stays one segment, never a path. The comment says exactly that: one encoded segment, never a path.

if not normalise(path).startswith(prefix): is defence in depth, a second check in case the first is ever weakened. It simplifies the final path and confirms it still begins with the intended prefix; if not, return Fail(400) refuses it again.

The comment # Internal service re-checks that the item belongs to session.user_id explains the last line: return internal.get(path, on_behalf_of=session.user_id). The proxy asks the internal service for the item, passing along who the user is, and the internal service checks for itself that the item belongs to that user. That is the third fix in action: the back office no longer trusts the receptionist's word.

The final comment gives the test cases: IDs containing ../, ..\, %2e%2e or %5c must return 400 and never reach internal.get. In plain words, the forward-slash traversal, the backslash traversal, the encoded dot-dot and the encoded backslash must all be refused before any internal request is made.

Variants to test

The write-up lists further checks a tester could run on a similar proxy. Each one names what to send and what a positive result looks like.

  • Encoding variants against the WAF. Send the same traversal with backslashes, double encoding and mixed separators. A positive result is a response that differs from the WAF block page and matches the internal service's error shape. Double encoding means encoding the encoded form, so %2e becomes %252e, in the hope that one decoding step is undone and the filter sees harmless text while the server later sees the real character.
  • Error-shape mapping. Compare responses for paths that do not exist, paths at the root and paths that reach a service. A positive result is a distinguishable "not found" versus "bad request" pattern that lets you infer where a request landed.
  • Top-level service enumeration. Walk the internal host's top-level names once you can reach it. A positive result is a service that answers with data rather than an error.
  • Search and filter endpoints. Look for count queries and filter parameters on any search service you reach. A positive result is a count that reflects production records and a filter that narrows to one user.
  • Proxy identity trust. Check whether internal services enforce per-user authorisation or accept anything arriving from the BFF. A positive result is data returned for a user the session does not own.

Key takeaways

  • A proxy that forwards user input is a second attack surface; test the hidden server, not just the visible one.
  • Different error shapes leak where your request landed, which makes internal mapping easy.
  • Internal APIs need authorisation too. "Only the BFF can reach it" fails the first time the BFF can be steered.

Glossary

  • API: a defined way for one program to ask another for data or to perform an action, like a waiter carrying orders between you and the kitchen.
  • Backend-for-frontend (BFF): a middle layer that sits between the browser and a company's internal services and fetches data on the browser's behalf.
  • Backslash: the \ character, used as a folder separator on Windows systems; a traversal written with it does the same job as ../.
  • Bug bounty: a reward a company pays to someone who reports a security flaw responsibly.
  • Count query: a request that asks a database how many records match, without returning the records themselves.
  • CVE: a catalogue of specific, individually numbered vulnerabilities.
  • CWE: a catalogue of weakness types, like a dictionary of known kinds of mistakes.
  • Defence in depth: layering several independent checks so that one failing does not open the door.
  • Enumerate: to list things one by one, for example walking the top-level names of an internal host.
  • Filter parameter: part of a request that narrows results, for example to a single user.
  • Fraud: the misuse of stolen data, for example to open accounts or take over existing ones.
  • HTTP status code: a number in a server's answer saying how it went, such as 200 for success, 400 for bad request and 404 for not found.
  • Internal service: a computer or program inside a company's network that only other company systems are supposed to reach.
  • Item ID: a short identifier for a piece of data, like a product code.
  • JSON: a common text format for data, made of names and values in curly braces.
  • Microsoft Graph: Microsoft's API for accessing data and services in the Microsoft cloud.
  • Normalise: to simplify a path into its final, unambiguous form, resolving every .. and ..
  • Path: the part of a web address after the domain name, used by servers like folders to decide what to return.
  • Phishing: a scam that uses real details about you to make a fake message convincing.
  • Production: the real, live data, as opposed to a test copy.
  • Proxy: a middleman that forwards requests from one system to another.
  • Segment: one piece of a path between slashes; forcing an ID to a single segment stops it containing slashes or backslashes.
  • URL encoding: writing special characters in a coded form, such as %2e for a dot, %2f for a forward slash and %5c for a backslash.
  • WAF (web application firewall): a filter in front of a website that blocks requests matching known attack patterns.
  • Web server: a computer that answers a browser's requests for pages and data.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.