HIGH 8.8

CVE-2026-49241: Angular Language Service VS Code Extension Arbitrary Code Execution

The Angular Language Service VS Code Extension allows developers to write Angular code with advanced IDE features like autocomplete and error checking. A critical flaw in versions before 21.2.4 lets an attacker hide malicious code in a project repository that automatically executes when a developer opens that folder in VS Code. The attack works by placing a fake TypeScript library file in the repository and configuring VS Code settings to point to it—the extension loads and runs this fake library without asking permission or checking if the workspace is trusted. An attacker only needs to commit the malicious code to a repository (like on GitHub) and wait for developers to clone and open it.

Source data · NVD / CISA · public domain

CVSS
3.1 · 8.8 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-427, CWE-494, CWE-79, CWE-94
Affected products
1 configuration(s)
Published / Modified
2026-06-22 / 2026-06-26

NVD description (verbatim)

The Angular Language Service VS Code Extension provides a rich editing experience for Angular templates. Prior to 21.2.4, the client-side Angular Language Service VS Code extension reads the custom TypeScript SDK paths typescript.tsdk and js/ts.tsdk.path directly from workspace configurations (.vscode/settings.json) without verifying VS Code Workspace Trust state or asking for user consent (located in client/src/client.ts). The client-side extension then passes the parsed settings path as a command-line argument (--tsdk) to the background Node.js language server process. During server initialization, the background language server resolves and dynamically imports (via standard Node.js require()) the module library tsserverlibrary.js relative to the workspace-specified custom directory path. An attacker can exploit this behavior by committing a repository containing a local malicious tsserverlibrary.js script inside a custom folder, and a crafted .vscode/settings.json file pointing to that folder. When a developer opens the repository folder in VS Code, the extension automatically attempts to initialize and load the server, which dynamically resolves, loads, and executes the malicious script silently in the background. This vulnerability is fixed in 21.2.4.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from unsafe dynamic module resolution in the Angular Language Service extension's client component. The extension reads TypeScript SDK path settings (typescript.tsdk and js/ts.tsdk.path) from workspace configuration files (.vscode/settings.json) without validating VS Code's Workspace Trust state or user consent. These untrusted paths are passed as command-line arguments to the background Node.js language server. During initialization, the language server calls require() to load tsserverlibrary.js from the attacker-controlled path, resulting in arbitrary code execution with the privileges of the Node.js process. This bypasses normal security prompts and trust mechanisms. The fix in 21.2.4 addresses the unsafe path handling and dynamic import logic.

Business impact

Developers using affected versions of the extension face supply-chain compromise risk when cloning or working with untrusted repositories. An attacker can execute arbitrary code on a developer's machine with the same privileges as the VS Code language server process, potentially leading to theft of credentials, source code exfiltration, installation of persistent backdoors, or lateral movement within corporate networks. For organizations with developers contributing to open-source projects or evaluating external code, this risk is particularly acute. The silent, background nature of the attack—no visible prompts or warnings—increases the likelihood of successful compromise.

Affected systems

The Angular Language Service VS Code Extension versions prior to 21.2.4 are affected. The vulnerability applies to any developer or organization using the extension to edit Angular templates in VS Code, regardless of operating system. The attack requires a developer to open a malicious repository in VS Code; it does not execute during clone or file browsing alone, but rather when the extension initializes its language server process.

Exploitability

Exploitability is high and requires only user interaction (opening a folder in VS Code), not elevated privileges or special network access. An attacker must craft a malicious repository with a fake tsserverlibrary.js file and matching .vscode/settings.json configuration, then distribute it through public repositories, email, or social engineering. Once a developer opens the folder, the malicious code executes automatically in the background without visible warnings. No specialized tools or knowledge of the extension internals is required to weaponize this attack; it is practical and scalable.

Remediation

Users must upgrade the Angular Language Service VS Code Extension to version 21.2.4 or later. Additionally, developers should review any .vscode/settings.json files in open repositories for suspicious typescript.tsdk or js/ts.tsdk.path entries pointing to non-standard locations. Organizations should enforce extension version pinning and provide security awareness training on the risks of opening untrusted repositories. Enabling VS Code's Workspace Trust feature (introduced in VS Code 1.52) provides a secondary control, though it does not prevent this specific attack without proper extension hardening.

Patch guidance

Update the Angular Language Service extension to 21.2.4 or later via the VS Code Extensions marketplace or command line (code --install-extension Angular.ng-template). Verify the update is applied by checking the extension version in VS Code's Extensions panel (Ctrl+Shift+X / Cmd+Shift+X). No configuration changes are required post-update; the patched version handles workspace settings securely. Organizations managing extensions centrally should stage and test the update in non-critical development environments before broad rollout.

Detection guidance

Monitor for unexpected or unauthorized Node.js child processes spawned by VS Code, particularly those with --tsdk command-line arguments pointing to unusual paths. Review .vscode/settings.json files in repositories for typescript.tsdk or js/ts.tsdk.path entries that reference subdirectories outside standard Node.js installation paths. Scan repositories for tsserverlibrary.js files not in the expected node_modules directory. In enterprise environments, use endpoint detection and response (EDR) tools to flag file modifications or execution from suspicious VS Code workspace directories. Additionally, monitor for exfiltration or credential access following VS Code language server initialization.

Why prioritize this

This vulnerability merits immediate attention due to its high CVSS score (8.8), practical exploitability, and silent execution model. The attack bypasses user awareness by running in the background without visible prompts, making it effective against security-conscious developers. The supply-chain nature—targeting development environments rather than production systems—creates a bridgehead for broader organizational compromise. While not yet listed on CISA's Known Exploited Vulnerabilities catalog, the low barrier to exploitation and widespread use of VS Code in development teams makes it an attractive target for sophisticated threat actors.

Risk score, explained

CVSS 8.8 (High) reflects the combination of network attack vector (malicious repository distribution), low complexity, no privilege requirements, user interaction (opening a folder), and high impact on confidentiality, integrity, and availability. The score accurately captures the severity: arbitrary code execution on a developer's machine with no authentication or privilege escalation needed. However, impact is somewhat localized to the individual developer's environment unless that developer has privileged access to shared systems or source code repositories. Organizations should treat this as a high-priority, high-visibility vulnerability given its targeting of development infrastructure.

Frequently asked questions

Can this vulnerability be exploited if I just clone a repository without opening it in VS Code?

No. The malicious code executes only when VS Code opens the repository folder and the Angular Language Service extension initializes its language server. Simply cloning or viewing files does not trigger the vulnerability.

Does upgrading to 21.2.4 protect me from malicious repositories I've already opened?

The upgrade prevents future attacks from malicious repositories, but does not undo any compromise that may have occurred before the upgrade. If you opened a suspicious repository with an older extension version, review your system for signs of unauthorized access, credential theft, or persistence mechanisms, and consider rotating passwords and API keys.

What does 'Workspace Trust' do, and is it sufficient protection?

VS Code's Workspace Trust feature (when enabled) restricts extension capabilities in untrusted folders, but the Angular Language Service extension, if running in trust mode without proper hardening, may still execute code during initialization. Workspace Trust is a useful secondary control but should not be relied upon as the sole mitigation; upgrading the extension is essential.

Are macOS, Linux, and Windows developers equally affected?

Yes. The vulnerability exists in the extension's core logic and affects all supported operating systems. The attack payload can be tailored to each platform, and the dynamic require() mechanism works consistently across Windows, macOS, and Linux.

This analysis is based on publicly disclosed vulnerability data and vendor advisories current as of the publication date. Patch version numbers and availability should be verified against Angular and Microsoft's official security advisories. This document provides informational guidance and does not constitute professional security advice. Organizations should conduct their own risk assessments and consult with security professionals before implementing mitigations. No exploit code or proof-of-concept details are provided herein. The vulnerability details are presented for defensive awareness purposes only. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).