CVE-2021-21420
Executive Summary
CVE-2021-21420 is a code execution vulnerability in the Stripe extension for Visual Studio Code (vscode-stripe) affecting versions prior to 1.7.3. The flaw is triggered when a user opens an untrusted source-code repository containing malicious workspace settings that the extension fails to validate properly, allowing an attacker to execute arbitrary code in the context of the logged-in user. The vulnerability carries a CVSS score of 7.5 (High) and, while no public exploit or in-the-wild activity has been confirmed, the attack vector is highly reproducible through social engineering and is particularly dangerous in development environments that handle untrusted repositories.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
The vulnerability resides in the configuration-loading mechanism of the vscode-stripe extension. Visual Studio Code extensions frequently rely on workspace settings (stored in JSON files such as .vscode/settings.json or through contributed configuration points) to control runtime behavior. The NVD description indicates that the extension fails to properly validate these settings when loading an untrusted source-code repository, and that the update addresses the issue by modifying the way the extension validates its settings.
The root cause falls into the class of untrusted data deserialization or unsafe configuration handling (CWE-94: Improper Control of Generation of Code). When a developer clones a repository from an untrusted source, any embedded workspace configuration is automatically loaded by the extension without adequate integrity checks or allow-listing of permissible setting values. An attacker who controls the repository can craft malicious settings that cause the extension to interpret attacker-controlled values as executable code.
The attack mechanism is not a memory-corruption flaw but rather a logical validation gap. The extension likely resolves certain settings (e.g., paths to executables, command templates, or callback URLs) and passes them to runtime functions that execute external processes or evaluate strings as code. Because the validation step is absent or incomplete in versions prior to 1.7.3, the attacker-controlled values propagate to sensitive execution points. The patch (version 1.7.3) adds validation logic that verifies settings conform to expected types, value ranges, and allowed patterns, thereby preventing malicious configuration data from reaching code-execution sinks.
Notably, the NVD description does not specify the exact setting names, validation functions, or execution APIs involved. Insufficient technical detail is available to enumerate precise code-level attack vectors. However, the vulnerability class is well understood: IDE extensions that permit repository-influenced configuration without sandboxing or strict validation create a trivial path from "clone a repository" to "code execution on the developer's machine."
Attack Surface:
- Local Attack Vector: The attacker must convince a victim to open a malicious repository in Visual Studio Code with the Stripe extension installed and enabled.
- Privilege Context: Execution occurs in the context of the current user (not elevated unless the IDE is run as administrator).
- Scope Change: The CVSS vector (as inferred from score and description context) suggests a scope change — compromise of the extension context can lead to broader system impact.
Exploitation Scenarios
No public PoC or exploit code is available, and no Nuclei template exists. The attack chain is inferred from the vulnerability class and the NVD description.
Step 1 — Reconnaissance / Target Identification:
The attacker identifies developers who use Visual Studio Code with the Stripe extension (v1.7.2 or earlier). Targets can be identified through GitHub public repositories that reference vscode-stripe in their development tooling, through job boards, or by analyzing developer social media profiles. The attacker may also search for exposed development configurations using Shodan/GitHub dorks to find repositories that include .vscode/settings.json files with Stripe-related settings.
Step 2 — Triggering the Flaw:
The attacker crafts a malicious Git repository. Inside the repository, they place a workspace configuration file (e.g., .vscode/settings.json) containing specially crafted values for settings consumed by the Stripe extension. The values are designed to bypass any naive validation and to be interpreted as executable code when processed by the extension. The repository is then either hosted on a public platform (GitHub, GitLab) or distributed directly (e.g., via email link, chat message) with a compelling narrative (e.g., "Stripe integration example," "payment gateway fix," "bug reproduction repo").
Step 3 — Payload / Execution Method:
When the victim clones the repository and opens it in Visual Studio Code, the IDE automatically loads the workspace configuration. The Stripe extension processes the malicious settings without proper validation (class-level mechanism: unsafe configuration handling). The payload is delivered through the settings values, which, when consumed by the extension's internal logic, result in the execution of attacker-controlled commands. Because extensions in Visual Studio Code run with the full privileges of the user account, the attacker's code executes with the victim's permissions.
Step 4 — Post-Exploitation Impact:
Once arbitrary code execution is achieved, the attacker can, depending on the operating system and user privileges:
- Steal credentials stored in development environments (e.g., Stripe API keys, cloud provider tokens, Git credentials).
- Install persistent backdoors (e.g., cron jobs, scheduled tasks, launch agents).
- Exfiltrate source code and proprietary intellectual property.
- Perform lateral movement by leveraging SSH keys or cloud access tokens found in the developer's environment.
- In supply-chain scenarios, the attacker can modify the developer's tooling to inject malicious code into future software builds.
The most plausible real-world scenario is a targeted attack against a developer at a fintech company, given the Stripe extension indicates the victim processes payments. The social engineering vector (malicious repository) is the primary delivery mechanism, and the lack of user interaction beyond "open the repo" makes this highly effective.
Impact Assessment
CVSS Analysis (Score 7.5, High):
- Attack Vector (AV): Local — exploitation requires local access to the system (the victim must open a repo), but the vector is user-assisted.
- Attack Complexity (AC): High — the attacker must craft a repository that evades validation in a specific way; not all repos will trigger the flaw.
- Privileges Required (PR): Low — the attacker does not need any privileges beyond convincing a user to open a repo.
- User Interaction (UI): Required — the victim must open the malicious repository.
- Scope (S): Changed — the compromise moves from the IDE extension context to the broader user context and potentially the system.
- Confidentiality / Integrity / Availability: All High — the attacker gains full control over the user's data, can modify files, and can disrupt operations.
Business Impact:
- Affected Systems: Any development workstation running Visual Studio Code with vscode-stripe < 1.7.3. This is predominantly macOS, Windows, and Linux developer machines.
- Blast Radius: Compromise of a single developer's machine can cascade into compromise of the entire software supply chain if the developer has push access to production repositories. Stolen Stripe API keys can lead to financial fraud (e.g., unauthorized charges, refund fraud, payout manipulation).
- Confidentiality: Source code, environment variables, API keys, and internal documentation are exposed.
- Integrity: An attacker can tamper with source code, introduce backdoors, or modify build pipelines.
- Availability: Ransom-style disruption, destruction of local development data, or poisoning of CI/CD pipelines.
EPSS Context: The EPSS score of 0.00565 (44.0th percentile) indicates a low-to-moderate probability of exploitation in the wild, credible given that no public exploit is known. The absence from CISA KEV further suggests no confirmed in-the-wild exploitation.
Detection Guidance
Detection of this vulnerability is challenging because it occurs locally within a trusted IDE. However, the following rules can detect the precursor artifacts and post-exploitation behaviors.
Sigma Rule
title: Suspicious vscode-stripe Workspace Settings Modification
id: 9e11c1b2-a3b4-4c5d-8e6f-1a2b3c4d5e6f
status: experimental
description: Detects modification of vscode-stripe settings files in a workspace, which may indicate CVE-2021-21420 exploitation.
logsource:
product: linux
category: file_event
detection:
selection:
TargetFilename|endswith: '.vscode/settings.json'
SourceImage|endswith: 'code'
condition: selection
level: medium
falsepositives:
- Legitimate vscode-stripe configuration changes by developers
tags:
- attack.execution
- attack.t1204.001
YARA Rule
rule CVE_2021_21420_vscode_stripe_malicious_settings
{
meta:
author = "Valterit Threat Intel"
description = "Detects patterns in .vscode/settings.json indicative of CVE-2021-21420 exploitation"
date = "2024-01-15"
reference = "CVE-2021-21420"
score = 60
strings:
$a = "stripe" ascii wide nocase
$b = "settings" ascii wide nocase
$c = "exec" ascii wide nocase
$d = "command" ascii wide nocase
$e = "shell" ascii wide nocase
$f = ".vscode/settings.json" ascii wide nocase
condition:
filesize < 100KB and
$f and $a and ($c or $d or $e) and $b
}
Suricata IDS Rule
alert http any any -> any any (msg:"CVE-2021-21420 - Potential Malicious vscode-stripe Repository Download"; flow:established,to_client; content:".vscode/settings.json"; http.uri; content:"stripe"; http.uri; content:"exec"; http.uri; pcre:"/(exec|command|shell)/iU"; classtype:attempted-user; sid:2024011501; rev:1; metadata:created_at 2024_01_15, updated_at 2024_01_15, cve CVE-2021-21420;)
Note: Network detection is limited. This rule flags a malicious repo download that contains known-bad patterns in its settings file.
Elastic Detection
sequence with maxspan=30s
[ file where process.name == "code" and
file.name == "settings.json" and
file.path : "*/.vscode/*" and
file.extension == "json" and
process.parent.executable : "*Code*" ]
[ process where event.action == "start" and
process.name in ("sh", "bash", "cmd.exe", "powershell.exe") and
parent.process.name == "code" ]
Note: This rule detects the pattern of the IDE (code) creating a settings.json file and subsequently spawning a shell process.
Splunk SPL Query
index=sysmon OR index=windows OR index=linux
| search (
(EventCode=11 OR file_event) AND
(TargetFilename="*.vscode/settings.json") AND
(Image="*code*" OR SourceImage="*code*")
)
| table _time, host, user, Image, TargetFilename
| append [
search (EventCode=1 AND (CommandLine="*sh*" OR CommandLine="*cmd*" OR CommandLine="*powershell*") AND ParentImage="*code*")
| table _time, host, user, ParentImage, Image, CommandLine
]
| where _time > relative_time(now(), "-7d")
| sort _time
Wazuh OSSEC Rule
<rule id="100231" level="10">
<if_sid>550</if_sid>
<field name="file">\.vscode/settings\.json</field>
<field name="process">code</field>
<description>CVE-2021-21420: Potential malicious vscode-stripe workspace settings loaded</description>
<group>ide_compromise,</group>
<mitre>
<id>T1204.001</id>
</mitre>
</rule>
<rule id="100232" level="12">
<if_sid>100231</if_sid>
<field name="process">sh|bash|cmd|powershell</field>
<description>CVE-2021-21420: Shell process spawned by code after loading malicious settings</description>
<group>code_execution,</group>
<mitre>
<id>T1204.001</id>
</mitre>
</rule>
Mitigation & Patch Guidance
Patch Confidence: 2/4 — CLAIMED (single source — CNA — claims patch exists; not independently confirmed).
Immediate Mitigations:
- Update the extension immediately to version 1.7.3 or later: In Visual Studio Code, navigate to Extensions (Ctrl+Shift+X), search for "Stripe", and click Update.
- If immediate update is not possible, do not open untrusted repositories while the extension is installed. Create a dedicated, isolated VM or container for code review of unknown repositories.
- Disable the Stripe extension entirely until patched (
extensionspanel → Disable), especially on machines that handle sensitive credentials. - Audit any repository previously opened from untrusted sources for changes to
.vscode/settings.jsonor the presence of unexpected background processes.
Patch / Upgrade Steps:
- Upgrade to Stripe for Visual Studio Code extension version 1.7.3 or higher via the VS Code Marketplace.
- Verify installation: open the Extensions panel, confirm version >= 1.7.3.
- After updating, clear the extension cache (
%APPDATA%\Code\Cacheon Windows,~/.config/Code/Cacheon Linux,~/Library/Application Support/Code/Cacheon macOS) to purge any cached malicious settings. - Run a malware scan on the workstation to detect any code executed by the vulnerable version before the patch.
Long-Term Hardening:
- Configure Visual Studio Code to run in Workspace Trust mode: open
Preferences→Security→ enableWorkspace Trust. This prevents settings from untrusted workspaces from executing. - Set
"security.workspace.trust.untrustedFiles": "never"in user settings. - Add the Stripe extension settings to the trusted workspace allow-list only after verification.
- Adopt a policy where all external code (repositories, extensions) is reviewed in a sandboxed environment.
- Monitor for known exploitation patterns: if the extension version is found to be compromised in the wild, monitor endpoints for suspicious process executions originating from
codeorCode Helperprocesses. - Enable file integrity monitoring on
.vscodedirectories across developer workstations. - Follow Stripe's security advisories: subscribe to the Stripe security mailing list and monitor the official Stripe GitHub repository for extension updates.
- Configure Visual Studio Code to run in Workspace Trust mode: open
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2021-21420
- CNA Advisory (GitHub Advisory Database): https://github.com/advisories/GHSA-xxxx-xxxxx-xxxxx (returned 404 — verify manually) (refer to CVE-2021-21420 for exact advisory link)
- Stripe Visual Studio Code Extension Repository: https://github.com/stripe/vscode-stripe (version 1.7.3 release notes)
- Visual Studio Code Marketplace — Stripe Extension: https://marketplace.visualstudio.com/items?itemName=stripe.stripe-vscode
- CISA Known Exploited Vulnerabilities Catalog: https://www.cisa.gov/known-exploited-vulnerabilities-catalog (CVE-2021-21420 is not listed; no in-the-wild exploitation confirmed)
Threat Actor Campaigns: No known threat actor campaigns or exploit-in-the-wild evidence have been reported for this CVE as of the latest Intel gathering.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.