Summary
Visual Studio Code Live Server extension v5.7.9 contains a vulnerability where crafted HTML content can drive the extension's local web server in a way that exposes files from the user's machine.
By enticing a user to open and interact with a malicious HTML page, an attacker may be able to exfiltrate local files that the Live Server instance can access.
Affected context
This vulnerability affects developers using the Live Server v5.7.9 extension in Visual Studio Code to serve local projects over HTTP.
It becomes relevant when:
- A developer opens or previews attacker-controlled HTML (or HTML including attacker-controlled content) using Live Server
- The extension serves local files and assets from the developer's workspace over a local HTTP endpoint
- Browser-side scripts are able to interact with the Live Server origin in a way that bypasses normal isolation assumptions
The issue is most concerning on machines where Live Server has access to sensitive project files, configuration data, or secrets stored alongside the served content.
Exploit preconditions
- Attack surface: The HTTP origin exposed by the Live Server extension in the developer's browser.
- Required access:
- The attacker must supply or influence HTML/JavaScript content that the developer opens via Live Server (e.g., malicious repo, sample project, or shared file).
- Network access to the developer's browser is not strictly required if the browser executes the malicious page locally.
- User interaction:
- The developer must open the crafted HTML file with Live Server or preview it through the extension.
- The developer's browser must execute the embedded JavaScript.
- Trigger point:
- When the malicious HTML page is rendered, its scripts interact with the Live Server origin (e.g., via requests, redirects, or dynamic resource loading) to read and exfiltrate accessible files.
- Why exploitation is possible:
- The Live Server environment fails to sufficiently isolate or constrain what browser scripts can request or infer from local files served by the extension.
- Combined with XSS-like behavior or open redirect-style flows (CWE-79, CWE-601), this enables data exposure scenarios consistent with CWE-200.
Why this happens
At a high level, the root cause is that untrusted HTML/JavaScript is served and executed in a browser context that has direct access to a local development origin exposing project files, without robust isolation or scoping.
This maps to:
- CWE-79 (Improper Neutralization of Input During Web Page Generation): HTML or script content that can be influenced by an attacker is processed in a way that allows arbitrary script execution under the Live Server origin or a related trusted context.
- CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor): Once running, the attacker-controlled script can request or infer the contents of local files that Live Server makes available, then exfiltrate them to a remote endpoint.
- CWE-601 (Open Redirect): If Live Server or related flows allow redirection to attacker-controlled locations while preserving sensitive context, this can be used to shuttle data off the local machine.
In abstract terms, the extension conflates "files convenient to serve for development" with "files safe to expose to any script that loads in the browser," treating local project content as implicitly trusted despite being potentially attacker-controlled.
Potential impact
- Exfiltration of source code files from the served workspace.
- Exposure of configuration files containing API keys, tokens, or other credentials stored in the project directory.
- Leakage of environment-specific files such as
.envor build artifacts capturing sensitive data. - Unauthorized disclosure of internal documentation or proprietary assets.
- Potential pivot into further attacks (e.g., abusing leaked secrets to access remote services or repositories).
General mitigation guidance
Mitigations revolve around reducing trust in served content, limiting file exposure, and constraining browser interaction with the local server:
- Isolate untrusted projects:
- Treat any third-party or sample project as untrusted.
- Open such projects in a separate, tightly scoped workspace with no secrets,
.envfiles, or sensitive configs present. - Restrict file exposure:
- Configure local development environments so that Live Server only serves a minimal, non-sensitive subset of the project tree.
- Avoid storing credentials, private keys, or production configuration alongside web assets.
- Reduce script trust:
- Prefer security-conscious development patterns such as Content Security Policy (CSP) in HTML templates to limit script capabilities where feasible.
- Avoid blindly executing third-party HTML/JavaScript during local development; review or sanitize content before serving it locally.
- Principle of least privilege:
- Run the editor and extension with the minimum filesystem access they need, instead of using high-privilege or broad user profiles.
- Secure development practices:
- Separate "development data" from "production secrets," ensuring that even if local files leak, they carry limited value.
- Establish internal guidelines that developers should not preview unknown or unreviewed HTML/JS projects with powerful local tooling.
How teams detect issues like this
Detection focuses on identifying risky patterns in both extension behavior and development workflows:
- Static and configuration analysis:
- Analyze extension code and configuration for:
- Unrestricted serving of directory trees.
- Open redirects or dynamic URL handling without origin checks.
- Use of browser APIs that blend local and untrusted content (e.g., frames, dynamic script injection).
- Code review signals:
- Watch for development tooling that:
- Treats any file under a project root as safe to serve.
- Does not distinguish between trusted and untrusted content in preview features.
- Does not enforce boundaries between public assets and secret-bearing files.
- Browser/network monitoring:
- Use local proxies or browser devtools to spot unexpected outbound requests from pages served by local development servers.
- Look for patterns where pages served from
localhostor similar origins send large payloads or textual file content to external domains. - Policy enforcement:
- Introduce team policies that restrict use of high-privilege development plugins with untrusted repositories.
- Optional use of automated tools in CI or internal security scanning to flag tooling or configs that expose entire project trees over HTTP.

