A newly disclosed vulnerability in Visual Studio Code’s webview implementation enables attackers to steal GitHub OAuth tokens, including read/write access to private repositories, through a single malicious link. Security researcher Ammar Askar publicly revealed the flaw on June 2, 2026, citing prior negative experiences with Microsoft’s Security Response Center (MSRC) as the reason for full disclosure.
How the Vulnerability Works
GitHub provides a browser-based VSCode editor at github.dev. When a user navigates from github.com to github.dev on any repository, the platform automatically transmits an OAuth token to the github.dev session. This token grants full access to every repository the user can access, not just the one being opened. The unscoped token, combined with the extensive VSCode TypeScript codebase running in the browser, creates an attractive target for exploitation.
VSCode isolates untrusted content using webviews that load from a separate vscode-webview:// origin, distinct from the main editor’s vscode-file:// origin. This cross-origin isolation prevents webview JavaScript from directly accessing VSCode’s Node.js or editor APIs. However, to enable communication between the editor and webviews, VSCode uses the Window.postMessage() API. The webview implementation registers a did-keydown event handler that forwards every keyboard event from inside the webview to the main VSCode window via postMessage. This allows keyboard shortcuts like Ctrl+Shift+P to function even when a user is focused inside a webview.
Exploit Details and Impact
The security boundary meant to separate dangerous APIs from untrusted user content is compromised because the postMessage channel for keyboard forwarding unintentionally links them. Untrusted JavaScript in a webview can create fake keydown events, simulating user keyboard input. This allows an attacker to construct an exploit chain where a single click triggers token exfiltration. The vulnerability affects anyone using the browser-based github.dev editor and could lead to unauthorized access to sensitive code repositories, data theft, or supply chain attacks.
Researcher Askar published a full proof-of-concept demonstrating the attack. Users of github.dev should exercise caution when clicking links from untrusted sources, and organizations may want to restrict access to the browser-based editor until a patch is available from Microsoft.
Source: Cyber Security News

