Threat intelligence, Threat Research

Rejetto HTTP File Server (HFS) unauthenticated session-forgery to Remote Code Execution

by Dhiren Vaghela

Rejetto HFS Pre-Auth Session
Forgery to RCE (CVE-2026-61500)

OVERVIEW

The SonicWall Capture Labs threat research team became aware of CVE-2026-61500, an unauthenticated session forgery vulnerability in Rejetto HTTP File Server (HFS) that leads to remote code execution (RCE), assessed its impact, and developed mitigation measures. A remote attacker can collect a small number of login responses, reconstruct the random number generator’s state, recover the signing key, and forge a valid administrator session cookie, leading to full administrative access and remote code execution via the server_code configuration feature. The vulnerability has a CVSS score of 9.8 and is classified as CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG). It has been added to CISA-KEV. Exploitation requires network access to the web interface, an unset (default) COOKIE_SIGN_KEYS environment variable, and a valid login-enabled username (e.g., admin). Rejetto HFS versions 3.0.0 through 3.2.0 (the TypeScript rewrite) are vulnerable.

TECHNICAL OVERVIEW

Rejetto HFS is a free, self-hosted web file server that lets users share files and folders directly from their computers over a network or the internet using a standard web browser. Instead of uploading files to a third-party cloud service or setting up a complex web stack, users run HFS locally and give visitors a link to browse and download shared files.

The flaw lies in predictable PRNG output, which compromises the session authentication mechanism and ultimately allows unauthenticated remote code execution. A pseudo-random number generator (PRNG) is an algorithm that generates a sequence of numbers that appear random but are derived from an initial seed and an internal state. Unlike a true random number generator, a conventional PRNG is deterministic. Given the same initial state, it produces the same sequence of outputs. In the vulnerable HFS implementation, the session-cookie signing key is derived from Math.random(). Outputs from the same generator are also exposed during the unauthenticated Secure Remote Password (SRP) login handshake.

This creates an unintended relationship between publicly observable values and a private cryptographic secret. The weakness can compromise administrator session integrity.

Figure_1_Vulnerable_Rejetto_HFS_Implementation.jpg
Figure 1: Vulnerable Rejetto HFS Implementation

The vulnerability stems from two interacting behaviors in Rejetto HFS 3.x:

  1. Predictable Key Generation at Startup: When the COOKIE_SIGN_KEYS environment variable is not explicitly set (the default configuration), HFS generates its session-cookie signing key using an internal helper function, randomId(30), backed by Math.random(). Because randomId(30) generates characters in batches, it consumes the first three outputs of the PRNG stream as soon as the server starts.
  2. Unauthenticated PRNG State Leak: During the SRP login handshake (loginSrp1), the server generates random challenge values using the same Math.random() instance and returns them inside a base64-encoded cookie to unauthenticated clients.
Figure_2_CVE-2026-61500_–_Sample_Vulnerable_Code.png
Figure 2: CVE-2026-61500 – Sample Vulnerable Code

The problem is not simply that the numbers are generated algorithmically. It is that Math.random() does not provide cryptographic unpredictability. HFS 3.2.1 addresses the vulnerability by using randomBytes() for cookie-signing keys and randomUUID() for login identifiers.

Figure_3_CVE-2026-61500_–_Vulnerable_vs_Patched_Rejetto’s_HFS.jpg
Figure 3: CVE-2026-61500 – Vulnerable vs. Patched Rejetto HFS

The vulnerability originates during session signing key initialization and becomes externally exposed through the authentication handshake. There is a distinction between the root cause, the external trigger and the eventual impact. The weak random-number generator is the root cause; exposure of its output through authentication functionality creates the attack surface. Figure 4 shows the vulnerability flow from its originating flaw to impact.

STAGE 1 – INSECURE SIGNING KEY GENERATION

The application relies on JavaScript’s non-cryptographic Math.random() function to generate the session-cookie signing key, making the security-sensitive key potentially predictable.

STAGE 2 – EXPOSURE OF PSEUDO-RANDOM VALUES

The unauthenticated login handshake exposes pseudo-random values generated using the same randomness source responsible for session signing key generation.

STAGE 3 – PRNG STATE COMPROMISE

The deterministic nature of the pseudo-random number generator allows its internal state to become potentially predictable through observable outputs, compromising the security of associated random values.

STAGE 4 – SESSION SIGNING KEY COMPROMISE

Predictability of the underlying randomness undermines the confidentiality of the session signing key, compromising the cryptographic integrity of authentication cookies.

STAGE 5 – AUTHENTICATION BYPASS

The compromised signing key enables session-cookie forgery, allowing an unauthenticated attacker to impersonate an authenticated administrator.

STAGE 6 – UNAUTHORIZED ADMINISTRATIVE ACCESS

The application trusts the forged session and grants administrative privileges, allowing unauthorized access to restricted server configuration and management functionality.

STAGE 7 – REMOTE CODE EXECUTION

Unauthorized administrative access enables abuse of the privileged server_code functionality, potentially resulting in arbitrary code execution within the security context of the HFS server process.

These stages represent the logical progression of one vulnerability, not seven independent security flaws. The fundamental weakness is insecure random-number generation (CWE-338).

Figure_4_CVE-2026-61500-Vulnerabiltiy_Chain.jpg
Figure 4: CVE-2026-61500 – Vulnerability Chain

TRIGGERING CONDITIONS

Figure 5 summarizes the triggering conditions. A login request alone does not cause remote code execution; it exposes the vulnerable randomness mechanism. Authentication bypass and RCE are consequences of compromised session integrity.

Figure_5_Triggering_Conditions_for_CVE-2026-61500.png
Figure 5: Triggering Conditions for CVE-2026-61500

EXPLOITATION

Exploitation begins once the attacker sends a small sequence of unauthenticated login initiation requests (loginSrp1) for the target username. After recovering the signing key and forging an administrator session cookie, the attacker uses the HFS Admin API to modify the server_code configuration setting. Because server_code allows administrators to execute custom server-side JavaScript within the Node.js runtime, the attacker achieves immediate arbitrary code execution via HTTP POST to that location.

Figure_6_Exploit_in_Action_–_CVE-2026-61500.gif
Figure 6: Exploit in Action – CVE-2026-61500
Figure_7_Exploit_Extract_–_CVE-2026-61500.jpg
Figure 7: Exploit Extract – CVE-2026-61500

SONICWALL PROTECTIONS

To ensure SonicWall customers are prepared for any exploitation that may occur due to this vulnerability, the following signature has been released:

Signature IDSignature Name
IPS: 22682Rejetto HFS Remote Code execution

REMEDIATION RECOMMENDATIONS

The risks posed by CVE-2026-61500 can be mitigated or eliminated with the following measures:

  • Verify that the installed version falls within the affected range.
  • Inspect the session signing key initialization logic.
  • Examine whether ordinary login responses contain PRNG-derived values.
  • Compare the randomness implementation against HFS 3.2.1.
  • Confirm that security-sensitive secrets use a cryptographically secure randomness source after patching.
  • Upgrade HFS: Update to version 3.2.1 or later, which replaces Math.random() with cryptographic randomness from the Node.js crypto module.
  • Set Static Signing Keys: Explicitly define a strong, high-entropy value for the COOKIE_SIGN_KEYS environment variable so the server never falls back to runtime key generation.
  • Restrict Admin Exposure: Limit administrative web access to trusted management networks or VPNs and disable server_code execution if the deployment does not require server-side scripting.
  • Follow the guidance in the VulnCheck Advisory.

RELEVANT LINKS

Share This Article

An Article By

Dhiren Vaghela

Senior Software Development Engineer

Dhiren Vaghela has over a decade of experience in the IPS domain, with a strong focus on defensive security. His expertise lies in identifying, analyzing and mitigating vulnerabilities. Dhiren is well-versed in content-based signature writing, scanner-based alert generation and technical blog writing. By leveraging emerging technologies, he has developed numerous IPS signatures across various protocols. Known for his exceptional signature writing skills and collaborative team spirit, Dhiren is a valuable asset in the field of cybersecurity.

Related Articles

  • Plex2Shell: Plex Media Server Exploit Chain SSRF to Arbitrary Code Execution
    Read More
  • IBM Langflow OSS unauthenticated RCE
    Read More