/

CVE-2026-49241

Severity:

HIGH RISK

(8.8)

Arbitrary Module Loading (CWE-94) in Angular VS Code Ext

CVE-2026-49241

Analyzed

Vulnerability type

Category:

Arbitrary Code Execution via Untrusted Configuration

CWE:

CWE-79, CWE-94, CWE-427, CWE-494

Impact:

Silent arbitrary code execution in developer tooling

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The Angular Language Service VS Code extension previously trusted workspace configuration to locate and load a TypeScript SDK library without validating workspace trust or user consent.

A malicious repository can define a custom SDK path and ship a rogue tsserverlibrary.js, causing the extension to silently execute attacker-controlled code when the folder is opened in VS Code.

Affected context

This vulnerability occurs in development environments where the Angular Language Service VS Code extension is installed and a project workspace contains custom TypeScript SDK path settings under .vscode/settings.json.

It becomes risky when developers open untrusted or third-party repositories that can control these workspace settings and place executable JavaScript libraries in referenced directories.

The issue is limited to the extension's background language server process but may be exacerbated by the privileges and network access available in the developer's environment.

Exploit preconditions

  • Attack surface: VS Code workspace containing Angular projects with the Angular Language Service extension enabled.
  • Required access: Ability to create or modify project files in a repository, including .vscode/settings.json and directories referenced by typescript.tsdk or js/ts.tsdk.path.
  • Trigger point: The developer opens the malicious repository folder in VS Code; the extension automatically initializes the background language server using the configured SDK path.
  • Why exploitation is possible: The client-side extension passes workspace-controlled SDK paths directly to the language server (--tsdk), which then resolves and requires tsserverlibrary.js relative to that path without checking workspace trust, validating the library source, or prompting the user.

Why this happens

At its core, this bug stems from treating workspace configuration as trusted input for locating executable code, then performing dynamic module loading without validation.

The client extension reads typescript.tsdk and js/ts.tsdk.path from .vscode/settings.json and forwards them to the language server, which uses Node.js require() to load tsserverlibrary.js from that path.

This pattern maps to CWE-94: Improper Control of Generation of Code, as attacker-controlled paths influence which code is loaded and executed; it is also related to insecure search path and update mechanisms where untrusted directories can override expected libraries.

Potential impact

  • Malicious JavaScript may execute with the privileges of the VS Code language server process.
  • Attackers could exfiltrate source code, credentials, or sensitive files accessible from the developer's machine.
  • Background processes may perform unauthorized network requests, such as contacting command-and-control servers.
  • Developer tooling integrity could be compromised, enabling supply-chain style attacks on builds or test runs.
  • Persistence mechanisms may be installed via additional scripts or configuration changes in the project.

General mitigation guidance

Mitigation generally focuses on preventing untrusted workspaces from influencing what code the extension loads and executes.

Secure patterns include tying executable library resolution to extension-controlled, well-known directories rather than workspace configuration; validating workspace trust state before honoring custom SDK paths; and requiring explicit user consent when a project attempts to override default toolchain locations.

Applying strict allowlists or schema validation to configuration values that feed into command-line arguments can reduce risk, as can designing language server processes to run with constrained privileges and limited filesystem or network access by default.

How teams detect issues like this

Detection often involves reviewing extension and tooling code for instances where user or workspace configuration directly affects executable paths, command-line flags, or module imports.

Static analysis rules can flag usages where configuration-derived strings are passed into require(), dynamic import(), or process launch parameters without normalization or trust checks.

Code review processes can emphasize examining client–server initialization flows in editor extensions, especially where background services consume configuration values without consulting workspace trust mechanisms.

Organizations may also apply policies or automated checks that scan repositories for suspicious .vscode/settings.json entries pointing SDKs or toolchains at project-local script directories.

Sources

SourceLink
github.comgithub.com/angular/angular/pull/68857
github.comgithub.com/angular/angular/pull/68886
github.comgithub.com/angular/angular/security/advisories/GHSA-ccq4-xmxr-8hcq

Frequently asked

questions

Exploitation typically occurs when a developer voluntarily opens a malicious or compromised repository in VS Code. The attacker usually delivers the payload via source control or shared project archives rather than direct remote access to the machine.

The attacker needs control over the project files, especially .vscode/settings.json and the directory that will contain the crafted tsserverlibrary.js. This is commonly achievable by publishing or modifying a repository that developers clone or open.

The safest approach is to decouple executable library resolution from workspace configuration, relying on trusted, extension-managed SDK locations or an allowlist of safe paths. Additionally, consult workspace trust state and prompt the user before loading code from project-defined locations.

Future tooling should treat workspace and user configuration as untrusted input, especially when it influences module loading or execution. Implement trust checks, strict validation and normalization of paths, explicit consent workflows, and run background processes with least privilege to limit the blast radius of any misconfiguration.

Find out what's already
exploitable in your codebase.