---
title: "1-Click GitHub Token Stealing via a VSCode Bug"
source_url: https://blog.ammaraskar.com/github-token-stealing/
ingested: 2026-06-04
sha256: ae301641d61de6c19827a325dc0a8ff602ef5f502bd6a617dda15e1329f6e967
tags: [security, vscode, github, vulnerability, token-theft, postmessage]
source: rss
---
# 1-Click GitHub Token Stealing via a VSCode Bug
> 来源:
Published Time: Wed, 03 Jun 2026 13:24:19 GMT
Markdown Content:
Just by clicking a link, it’s possible for an attacker to steal a GitHub token that can read and **write** to your repos, including **private ones**.
### Table of Contents
* [Background](http://blog.ammaraskar.com/github-token-stealing/#background)
* [VSCode Webview Security Model](http://blog.ammaraskar.com/github-token-stealing/#vscode-webview-security-model)
* [The Bug](http://blog.ammaraskar.com/github-token-stealing/#the-bug)
* [PoC and Protecting Yourself](http://blog.ammaraskar.com/github-token-stealing/#poc-and-protecting-yourself)
* [What VSCode Did Well](http://blog.ammaraskar.com/github-token-stealing/#what-vscode-did-well)
* [Why Full Disclosure](http://blog.ammaraskar.com/github-token-stealing/#why-full-disclosure)
* [Timeline](http://blog.ammaraskar.com/github-token-stealing/#timeline)
## Background
Did you know GitHub has this really cool feature [called github.dev](https://docs.github.com/en/codespaces/the-githubdev-web-based-editor#about-the-githubdev-editor)?
On any repository you have access to, if you can change the url from `github.com` to `github.dev`_or_ you click this little menu item:

You’ll be launched into a little light-weight version of VSCode that runs entirely in your browser (I guess that’s one advantage of having your app written with electron).

This browser instance of VSCode is pretty powerful, you can view all the files in the repo (even if it’s a private one), you can send out pull requests and even make commits.
This functionality is achieved by `github.com` POSTing over an OAuth token to `github.dev` that allows it to interact with GitHub on your behalf. The token is **not scoped to the particular repo you interacted with**, meaning it has full access to every other repo that you have access to.
The presence of this token and the fact that this web-app is running almost the entire brunt of VSCode’s million line Typescript codebase makes it a great target for anyone looking into VSCode bugs. That sort of bug is what we’ll explore here and show how an attacker can use it to exfiltrate your GitHub token.
## VSCode Webview Security Model
Being an electron app on the desktop, executing arbitrary Javascript inside of VSCode would be tantamount to full remote code execution. This is why VSCode implements some sandboxing approaches, the one we’ll focus on here is [VSCode’s webviews](https://code.visualstudio.com/api/extension-guides/webview).
Webviews use an `