CVE-2021-30502
Description
The unofficial vscode-ghc-simple (aka Simple Glasgow Haskell Compiler) extension before 0.2.3 for Visual Studio Code allows remote code execution via a crafted workspace configuration with replCommand.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
2- vscode-ghc-simple/Simple Glasgow Haskell Compilerdescription
- Range: <0.2.3
Patches
Vulnerability mechanics
Root cause
"Missing trust validation for the `replCommand` workspace configuration allows arbitrary command execution."
Attack vector
An attacker crafts a malicious Visual Studio Code workspace (e.g., a repository) containing a `.vscode/settings.json` that sets `ghcSimple.replCommand` to an arbitrary command (e.g., a reverse shell or malware). When the victim opens the workspace in VS Code with the vulnerable extension installed, the extension reads the workspace configuration and executes the attacker-controlled `replCommand` without any user prompt or validation. This allows remote code execution in the context of the victim's VS Code process [ref_id=1].
Affected code
The vulnerability resides in the workspace configuration handling of the vscode-ghc-simple extension. The `replCommand` setting, which specifies the command to launch GHCi, is read from workspace configuration without any trust mechanism. The patch introduces a `ghcSimple.trustedReplCommandConfigs` application-scoped setting to track which `replCommand` configurations the user has explicitly trusted [ref_id=1].
What the fix does
The patch adds a new `ghcSimple.trustedReplCommandConfigs` setting scoped to `application` (not workspace), which records which `replCommand` configurations the user has explicitly trusted. Before executing `replCommand`, the extension now checks whether the configuration is in this trusted list. If not, the user is prompted to approve or reject the command. This prevents arbitrary command execution from untrusted workspace configurations because the attacker-controlled `replCommand` will not be in the user's trusted list unless the user explicitly approves it [ref_id=1].
Preconditions
- configVictim must have the vscode-ghc-simple extension (version < 0.2.3) installed in VS Code.
- inputVictim must open a malicious workspace (e.g., a cloned repository) that contains a crafted .vscode/settings.json with a ghcSimple.replCommand setting.
- authNo user trust prompt or validation is performed before executing the workspace-defined replCommand.
Generated on May 29, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4- github.com/dramforever/vscode-ghc-simple/blob/master/CHANGELOG.mdmitrex_refsource_CONFIRM
- github.com/dramforever/vscode-ghc-simple/commit/bc7f6f0b857dade46ea51496d8bd1a4edef39b46mitrex_refsource_CONFIRM
- github.com/dramforever/vscode-ghc-simple/releasesmitrex_refsource_MISC
- vuln.ryotak.me/advisories/38mitrex_refsource_MISC
News mentions
0No linked articles in our index yet.