Skip to content
Access control Write-up Intermediate

Steam Access Control Bug: The Zero That Leaked Keys

The Steam partner portal's key-download function checked ownership of a key set only when a non-zero quantity was requested; setting the quantity to zero skipped the check and returned the entire key set. An authenticated partner could therefore download other studios' game keys, potentially all keys ever generated.

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

Steam's partner portal is the site where developers generate and download activation keys for their own games. A download request names a key set and states how many keys to take from it. Because keys are the commercial product, the portal has to make sure that the partner making the request actually owns the app behind the key set.

In 2018 Artem Moskowsky found that this ownership check could be skipped. Asking for zero keys from someone else's key set returned the whole set. In one test that meant 36,000 Portal 2 keys. Valve fixed the issue within days and paid $20,000: a $15,000 bounty plus a $5,000 bonus. The HackerOne report rated it critical. There is no CVE, since this is a hosted service.

AI-generated illustration From the original on medium.com

AI-generated illustration

Setup

The only precondition described is an authenticated partner account. The key-download function was reachable by any authenticated partner, and the researcher used his own account to request key sets belonging to other studios. The report does not describe the tooling used beyond sending requests to the portal.

Finding it

The researcher started from a normal download request: it named a key set and a quantity. When he pointed the request at another studio's key-set ID, the server returned an error saying he had no assignment for that set. That is the expected behaviour, and it showed that ownership was being checked.

He then changed the quantity to zero. The ownership check disappeared from the response path, and the server returned the full contents of the key set instead of an error. The request that was refused with a positive count returned the full set once the count was zero.

Exploitation

Step 1: request another studio's key set

Send a download request naming a key-set ID that belongs to a different partner, with a normal positive quantity. The server responds with an error stating that the requester has no assignment for that set. This confirms the ownership check is present on this path.

Step 2: set the quantity to zero

Repeat the same request against the same foreign key-set ID, changing only the number of keys requested to zero. The ownership error no longer appears, and the response contains the full contents of the key set. In one test this returned 36,000 Portal 2 keys.

The report does not include the raw HTTP request or response for either step; it describes the behaviour only. Reproduction details were deliberately left out of the write-up.

Step 3: scale it

Key-set IDs were guessable, and according to the researcher there were more than 430,000 key sets in existence. With one partner account, an attacker could in principle have pulled every key Steam developers had ever generated.

Root cause

Valve has not published the root cause. A plausible reading, and the one the write-up offers, is that the ownership test lived inside the "assign N keys" branch of the handler. A count of zero took a different path that went straight to export, so the check existed but did not run on every path to the data. This is a classic authorization bug: the control is present, but not on all branches.

The ownership check did stop the ordinary request. A plausible reading is that the quantity parameter decided which code path ran, and zero bypassed the branch containing the check.

Impact

Steam keys are money. Leaked keys get resold on grey markets, and each activation is a lost sale. Under the conditions described, any authenticated partner could in principle retrieve the full key set of any other studio whose key-set ID they could guess, and with guessable IDs and more than 430,000 sets, potentially every key ever generated.

Valve reports that audit logs still recorded these requests, and that reviewing them showed no prior or ongoing exploitation.

Timeline from the report: submitted and triaged on 7 August 2018, rewarded and resolved on 11 August, publicly disclosed on 31 October.

Fix

Valve fixed the bug within days; the report does not describe the code change. The write-up sets out the defensive pattern it recommends:

  1. Authorize first, unconditionally. Ownership is checked before any parameter decides which code path runs.
  2. Treat edge values as invalid, not special. Zero, negative, empty and huge counts should fail validation, not mean "everything".
  3. Keep the audit trail. It let Valve rule out abuse.

The write-up's illustrative handler, reproduced as published:

Python
def download_keys(session, key_set_id, count):    key_set = key_sets.get(key_set_id)    if key_set is None or not partner_owns_app(session.partner_id, key_set.app_id):        audit("key_download_denied", session.partner_id, key_set_id)        return deny("not_found")                         if type(count) is not int or count < 1 or count > MAX_KEYS_PER_REQUEST:        return reject("invalid_count")                   keys = key_sets.allocate(key_set.id, session.partner_id, count)      audit("key_download", session.partner_id, key_set.id, len(keys))    return keys

Variants to test

  • Zero and negative counts. Send a quantity of 0 or -1 to a bulk export or allocation endpoint for a resource you do not own. A positive result is a full export or a success response where an ownership error is expected.
  • Empty and missing parameters. Omit the quantity, or send an empty value, on the same endpoint. A positive result is the handler falling through to the export path instead of rejecting the request.
  • Very large counts. Request an absurd quantity. A positive result is either an unbounded export or an error that reveals the internal limit and the branch structure.
  • Other user-controlled selectors. Change the resource identifier (key-set ID, order ID, file ID) while keeping the quantity at an edge value. A positive result is data belonging to another tenant.
  • Branch enumeration. Compare error messages and status codes across parameter values to map which inputs reach which code path. A positive result is a value that skips the ownership check entirely.

Key takeaways

  • An authorization check that only runs on some branches is a bypass waiting for the right input.
  • Boundary values (0, -1, empty) belong in every access-control test plan.

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

What happened, in plain words

Steam is a store and launcher for computer games. Besides selling games to players, Steam runs a partner portal: a website where game developers and publishers manage the games they sell. One of the things they do there is generate activation keys, the long codes you type into Steam to add a game to your account. A key is how a studio sells its game through other shops, or hands out review copies, or bundles a game with a physical box.

Because keys are the product, the portal has to be careful about who gets them. When a developer asks to download keys, the request names a key set (a batch of keys belonging to one game) and says how many keys to take from it. The portal is supposed to check that the person asking really owns the game behind that key set. Otherwise any developer could walk off with another studio's keys.

In 2018 a researcher called Artem Moskowsky found that this check could be skipped. If he asked for keys from someone else's key set, the portal refused. If he asked for zero keys from that same set, the portal handed over the whole set. In one test that was 36,000 Portal 2 keys. Valve, the company behind Steam, fixed it within days and paid $20,000: a $15,000 bounty plus a $5,000 bonus. The bug report on HackerOne was rated critical. There is no CVE number, because this was a live service rather than a piece of software with versions.

AI-generated illustration From the original on medium.com

AI-generated illustration

A few words before we start, because they come up constantly:

  • An API (application programming interface) is the set of addresses a website's own pages use to talk to its servers. When you click a button in a browser, the page usually sends a request to one of these addresses and shows you the answer. Think of a restaurant: the menu is the website, the kitchen is the server, and the API is the waiter who carries your order back and forth.
  • A request is one message from your browser to a server: "give me this page", "save this change", "download these keys". It carries a method (what kind of action), a URL (where), and often some parameters (details, like how many).
  • A parameter is a named value inside a request, for example a quantity. Changing a parameter is like changing the number on an order form.
  • A session is how a website remembers that you are logged in. After you sign in, the server gives your browser a small piece of data (often called a cookie or a token) that it sends back with every later request. It works like a wristband at an event: you show it once at the door, and after that staff just glance at your wrist.
  • Authentication means proving who you are (logging in). Authorization means deciding what you are allowed to do once you are known. The bug here is an authorization bug: the portal knew exactly who the researcher was, it just failed to check what he was allowed to download.
  • Access control is the general name for the rules that decide who may see or do what. When those rules can be sidestepped, the usual label is improper access control.

Context

The partner portal is the site where developers generate and download activation keys for their own games. A download request names a key set and states how many keys to take from it. Because keys are the commercial product, the portal has to make sure that the partner making the request actually owns the app behind the key set.

In 2018 Artem Moskowsky found that this ownership check could be skipped. Asking for zero keys from someone else's key set returned the whole set. In one test that meant 36,000 Portal 2 keys. Valve fixed the issue within days and paid $20,000: a $15,000 bounty plus a $5,000 bonus. The HackerOne report rated it critical. There is no CVE, since this is a hosted service.

A bounty here means Valve's bug bounty programme: a standing offer to pay people who report security problems responsibly instead of using them. A CVE is a public catalogue number given to a specific flaw in specific software, so that everyone can refer to the same thing. A website that Valve runs itself has no version number for the public to patch, so it gets no CVE.

AI-generated illustration From the original on medium.com

AI-generated illustration

Setup

The only precondition described is an authenticated partner account. The key-download function was reachable by any authenticated partner, and the researcher used his own account to request key sets belonging to other studios. The report does not describe the tooling used beyond sending requests to the portal.

In plain terms: he did not need to break into anything to start. He signed up or logged in as an ordinary partner, the same way any small studio would, and then used his own legitimate access to ask for things that were not his. The report does not say which tools he used to send the requests; a browser's developer tools, which show every request a page makes, would be enough to see and change them.

Finding it

The researcher started from a normal download request: it named a key set and a quantity. When he pointed the request at another studio's key-set ID, the server returned an error saying he had no assignment for that set. That is the expected behaviour, and it showed that ownership was being checked.

A key-set ID is the identifier of one batch of keys. It is the part of the request that says which set you want, in the same way a house number says which house. "No assignment" means the portal looked at his account, looked at the set, and concluded the two were not connected.

He then changed the quantity to zero. The ownership check disappeared from the response path, and the server returned the full contents of the key set instead of an error. The request that was refused with a positive count returned the full set once the count was zero.

This is the heart of the bug, and it is worth slowing down for. The portal had two jobs on this request: check that he owned the set, and then produce the keys. The check was there, and it worked for a normal number. But the number itself decided which piece of code handled the request. With a normal number, the request went through the piece that checked ownership. A plausible reading is that with zero it went through a different piece that skipped straight to producing the keys, as if the guard stood at one door and there was a second.

Exploitation

Step 1: request another studio's key set

Send a download request naming a key-set ID that belongs to a different partner, with a normal positive quantity. The server responds with an error stating that the requester has no assignment for that set. This confirms the ownership check is present on this path.

Why do this first? Because before you can claim a check is missing, you have to show it exists and works. This step is the baseline: the same request, done the honest way, is refused. Everything after it is a comparison against this refusal.

Step 2: set the quantity to zero

Repeat the same request against the same foreign key-set ID, changing only the number of keys requested to zero. The ownership error no longer appears, and the response contains the full contents of the key set. In one test this returned 36,000 Portal 2 keys.

Why zero? Because zero is a strange number for a download. Nobody wants a download of nothing, so the code that handles "give me N keys" may treat zero as a special case, or skip the work entirely, or take a shortcut. The researcher was testing whether the ownership check was tied to the normal path only. It was.

The report does not include the raw HTTP request or response for either step; it describes the behaviour only. Reproduction details were deliberately left out of the write-up. That is normal for a public write-up of a fixed bug: enough detail to learn from, not a recipe for repeating it.

Step 3: scale it

Key-set IDs were guessable, and according to the researcher there were more than 430,000 key sets in existence. With one partner account, an attacker could in principle have pulled every key Steam developers had ever generated.

"Guessable" means the IDs were not long random strings that are impossible to predict, but something a program could work through. Combine that with the zero trick, and one ordinary account becomes a machine that can walk through every set in turn. The report says "in principle": this is what the flaw allowed, not what was done.

Root cause

Valve has not published the root cause. A plausible reading, and the one the write-up offers, is that the ownership test lived inside the "assign N keys" branch of the handler. A count of zero took a different path that went straight to export, so the check existed but did not run on every path to the data. This is a classic authorization bug: the control is present, but not on all branches.

A branch is a fork in a program: if the number is above zero, do this; otherwise, do that. A handler is the piece of server code that deals with one kind of request. The picture is a corridor with a security desk in front of one doorway. Most visitors are sent through that doorway and get checked. A visitor who says "zero" is waved down a side corridor that leads to the same room, with nobody at the desk.

The ownership check did stop the ordinary request. A plausible reading is that the quantity parameter decided which code path ran, and zero bypassed the branch containing the check.

Impact

Steam keys are money. Leaked keys get resold on grey markets, and each activation is a lost sale. Under the conditions described, any authenticated partner could in principle retrieve the full key set of any other studio whose key-set ID they could guess, and with guessable IDs and more than 430,000 sets, potentially every key ever generated.

A grey market is a place where keys are resold outside the official shops, often cheaply and often without the developer's consent. Every key activated there is a copy the studio did not sell.

Valve reports that audit logs still recorded these requests, and that reviewing them showed no prior or ongoing exploitation.

An audit log is a record the server keeps of who did what and when. It is the difference between "we think nobody abused this" and "we looked and nobody did". Valve could say the second because the requests had been written down.

Timeline from the report: submitted and triaged on 7 August 2018, rewarded and resolved on 11 August, publicly disclosed on 31 October.

Triaged means the receiving team read the report, confirmed it was real and serious, and put it in the queue to be fixed. Four days from submission to resolution is fast.

Fix

The write-up sets out the defensive pattern it recommends:

  1. Authorize first, unconditionally. Ownership is checked before any parameter decides which code path runs.
  2. Treat edge values as invalid, not special. Zero, negative, empty and huge counts should fail validation, not mean "everything".
  3. Keep the audit trail. It let Valve rule out abuse.

Point 1 is about order: check the wristband at the door, before anyone asks how many drinks they want. Point 2 is about refusing strange numbers outright instead of inventing meanings for them. Point 3 is about being able to answer questions afterwards.

The write-up's illustrative handler, reproduced as published:

Python
def download_keys(session, key_set_id, count):    key_set = key_sets.get(key_set_id)    if key_set is None or not partner_owns_app(session.partner_id, key_set.app_id):        audit("key_download_denied", session.partner_id, key_set_id)        return deny("not_found")                         if type(count) is not int or count < 1 or count > MAX_KEYS_PER_REQUEST:        return reject("invalid_count")                   keys = key_sets.allocate(key_set.id, session.partner_id, count)      audit("key_download", session.partner_id, key_set.id, len(keys))    return keys

Line by line, in plain words:

  • def download_keys(session, key_set_id, count): defines the handler. It receives three things: the session (who is asking), the key-set ID (which batch), and the count (how many keys).
  • key_set = key_sets.get(key_set_id) looks up the batch in the database. If the ID does not exist, the result is empty.
  • if key_set is None or not partner_owns_app(session.partner_id, key_set.app_id): is the ownership check, and it comes first, before the count is looked at. It asks two questions: does this set exist, and does the partner behind this session own the app this set belongs to?
  • audit("key_download_denied", session.partner_id, key_set_id) writes down the refusal: who asked, for which set.
  • return deny("not_found") answers with a refusal. The message says "not found" rather than "not yours", so the answer does not confirm that the set exists.
  • if type(count) is not int or count < 1 or count > MAX_KEYS_PER_REQUEST: validates the number. It must be a whole number, at least one, and no more than a fixed maximum. Zero, negative numbers, empty values and absurdly large numbers are all refused here.
  • return reject("invalid_count") answers a bad number with a plain rejection.
  • keys = key_sets.allocate(key_set.id, session.partner_id, count) is the only place keys are produced, and it is reached only after both checks have passed.
  • audit("key_download", session.partner_id, key_set.id, len(keys)) records the successful download and how many keys it contained.
  • return keys sends the keys back.

The important shape is that there is one road to the keys, and both checks sit on it. Nothing about the number can route the request around the ownership check.

Variants to test

These are the general lessons the write-up draws for anyone testing similar features. Each one is a way of asking the same question: can I reach the data by going around the check?

  • Zero and negative counts. Send a quantity of 0 or -1 to a bulk export or allocation endpoint for a resource you do not own. A positive result is a full export or a success response where an ownership error is expected.
  • Empty and missing parameters. Omit the quantity, or send an empty value, on the same endpoint. A positive result is the handler falling through to the export path instead of rejecting the request.
  • Very large counts. Request an absurd quantity. A positive result is either an unbounded export or an error that reveals the internal limit and the branch structure.
  • Other user-controlled selectors. Change the resource identifier (key-set ID, order ID, file ID) while keeping the quantity at an edge value. A positive result is data belonging to another tenant.
  • Branch enumeration. Compare error messages and status codes across parameter values to map which inputs reach which code path. A positive result is a value that skips the ownership check entirely.

A selector is the part of a request that picks which item you mean, such as an ID. Branch enumeration means trying many values and reading the replies to work out the shape of the code inside, the way you might tap a wall in different places to find where it is hollow.

Key takeaways

  • An authorization check that only runs on some branches is a bypass waiting for the right input.
  • Boundary values (0, -1, empty) belong in every access-control test plan.

Glossary

  • Access control: the rules that decide who is allowed to see or do what.
  • Activation key: a code that adds a game to a Steam account when entered.
  • API: the set of addresses a website's pages use to talk to its servers.
  • Audit log: a record the server keeps of who did what and when.
  • Authentication: proving who you are, usually by logging in.
  • Authorization: deciding what a known user is allowed to do.
  • Bounty: a payment offered by a company to someone who reports a security flaw responsibly.
  • Branch: a fork in a program where different inputs lead to different code.
  • Branch enumeration: trying many input values and comparing the replies to work out the code's internal paths.
  • Cookie: a small piece of data a site stores in your browser so it can recognise you on later requests.
  • CVE: a public catalogue number for a specific flaw in specific software.
  • Grey market: unofficial resale of keys, often without the developer's consent.
  • Handler: the piece of server code that deals with one kind of request.
  • Improper access control: a flaw where the rules about who may do what can be sidestepped.
  • Key set: a batch of activation keys belonging to one game.
  • Key-set ID: the identifier of one such batch, used in a request to say which batch is meant.
  • Parameter: a named value inside a request, such as a quantity.
  • Partner portal: the website where developers manage the games they sell on Steam.
  • Request: one message from a browser to a server asking for something or sending something.
  • Selector: the part of a request that picks which item is meant, such as an ID.
  • Session: the state that lets a site remember you are logged in across requests.
  • Token: a piece of data, similar to a cookie, that proves to the server who is asking.
  • Triaged: read, confirmed as real and serious, and queued for fixing by the receiving team.
  • Valve: the company that runs Steam.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.