Shopify: a GitHub key hidden in an app anyone could download
A desktop application that Shopify distributed to the public carried a GitHub token that could read and change its private code.
New here? Try the first lesson without an accountCompany or project
Shopify
When
Reported: 26 Jan 2021 · disclosed: 26 Jul 2021
Reference
HackerOne #1087489
Severity and scale
Critical (CVSS 10) · USD 50,000 bounty
The story
In January 2021, researcher Augusto Zanellato looked inside a desktop application that Shopify offered for download. Among its files he found something that did not belong there: an access token for GitHub, the site where Shopify keeps its code, which belonged to a Shopify employee. He reported it through HackerOne. Shopify gave it the highest possible score and paid him a 50,000-dollar bounty.
The term, explained simply
An access token is like a hotel key card: it does not carry your name or your password, but it opens the doors it was programmed for. Programs use tokens to work without typing a password. Now imagine that card glued inside a leaflet handed out on the street. That mistake is called secret exposure: a secret (a password, a key or a token) ends up somewhere other people can read it. Everything shipped inside a downloadable app can be opened and read, even if it never shows on screen.
The root cause
A secret was stored inside a program that was distributed to the public, and that secret was powerful: it could read and write the company’s private repositories.
What could happen
The token could read and modify Shopify’s private repositories on GitHub, that is, see its internal code and change it. Shopify rated it critical (CVSS 10 out of 10) and paid 50,000 dollars.
How it was fixed and how to prevent it
Shopify revoked the token immediately, meaning it cancelled it so it would stop working, and reviewed the access logs: it found no unauthorized use. To prevent it: no secret travels inside an application that is distributed; tokens get the minimum permission and an expiry date; and an automatic review looks for forgotten keys in the code and in every release before it is published.
Practice it in Hackory
Sources
Official documents and the researcher’s own write-up. We tell the story, the concept and the defense; there are no steps to repeat the attack.
