A significant security flaw in Visual Studio Code’s webview implementation has been identified, allowing malicious actors to steal GitHub OAuth tokens. This vulnerability could provide unauthorized access to users’ private repositories, requiring only a single malicious link click by the victim.
Details of the Vulnerability
On June 2, 2026, security expert Ammar Askar publicly disclosed this vulnerability. Askar chose to fully disclose the issue due to prior unsatisfactory interactions with Microsoft’s Security Response Center. The flaw is particularly concerning given that GitHub’s lightweight VSCode editor, accessed via github.dev, automatically transfers a user’s OAuth token from github.com. This token grants comprehensive access to all repositories the user has permission to access.
VSCode Webview Security Model
VSCode’s webview model is designed to isolate untrusted content through sandboxed iframes. However, it uses a postMessage API that allows communication between the main editor and these webviews. A vulnerability arises when untrusted JavaScript can simulate keyboard input, crossing the intended security boundaries.
Exploit Methodology
Askar demonstrated a complete exploit chain, which involves using a malicious Jupyter Notebook file to execute arbitrary JavaScript within a webview iframe. The attack can then silently install a malicious extension, bypassing trust checks by exploiting github.dev’s workspace trust characteristics.
Once installed, the extension can access preloaded GitHub OAuth tokens, allowing the attacker to enumerate and potentially modify private repositories. The vulnerability is particularly severe because the stolen token is not restricted to a single repository, making it a lucrative target for attackers.
Mitigation and Response
Users are advised to clear site data for github.dev in their browsers and avoid clicking on suspicious github.dev links until a patch is released. Regular auditing of installed extensions on github.dev is also recommended.
The incident highlights the need for robust security measures and timely updates to protect user data and prevent unauthorized access.
