Rejetto HFS Predictable PRNG Session Forgery to RCE (CVE-2026-61500)
Published: 2026-11-27 • Researcher: A. Ramos (aramosf); vulnerability discovered by Zach Hanley, Horizon3.ai
- Severity
- Critical
- CVE
- CVE-2026-61500
- Category
- web
- Affected product
- Rejetto HTTP File Server (HFS)
- Affected versions
- 3.0.0 through 3.2.0 (fixed in 3.2.1)
- Disclosed
- 2026-11-27
- Patch status
- Patched
References
- https://www.cve.org/CVERecord?id=CVE-2026-61500
- https://www.vulncheck.com/advisories/rejetto-hfs-session-forgery-via-predictable-signing-key
- https://github.com/rejetto/hfs/releases/tag/v3.2.1
- https://github.com/rejetto/hfs/commit/59472e534bf7e056d708382d02935c2eaf956927
- https://github.com/aramosf/CVE-2026-61500
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2026-09-26 |
| Author / Researcher | A. Ramos (aramosf); vulnerability discovered by Zach Hanley, Horizon3.ai |
| CVE / Advisory | CVE-2026-61500 |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.8 (CVSS 3.1 — per CVE record/NVD) |
| Status | Weaponized |
| Tags | Rejetto, HFS, PRNG, xorshift128, session-forgery, CWE-338, unauthenticated, RCE, Node.js |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Rejetto HTTP File Server (HFS) |
| Versions Affected | 3.0.0 through 3.2.0 (fixed in 3.2.1) |
| Language / Platform | JavaScript / Node.js (V8), Windows, Linux, macOS |
| Authentication Required | No |
| Network Access Required | Yes (HTTP API) |
Summary
Rejetto HFS 3.0.0 through 3.2.0 derived the signing key for its session cookies from JavaScript’s non-cryptographic Math.random generator. The same generator’s output was exposed to unauthenticated clients as the numeric login session identifier in the SRP login handshake. By collecting a handful of login responses, a remote attacker can reconstruct the generator state, recover the signing key, and forge an administrator cookie. The forged session enables administrative configuration changes, including server-side JavaScript execution through the server code setting, resulting in remote code execution.
Vulnerability Details
Root Cause
HFS generated its Koa session-cookie signing key with the V8 Math.random implementation, a predictable xorshift128+ PRNG, and leaked successive outputs of that same generator as the numeric loggingIn sid value in the unauthenticated loginSrp1 response. The 53 high bits of each observed double leave only 11 unknown low bits per value, so five or more consecutive outputs are enough to brute force the state. The key itself is assembled from three base-36 chunks produced by randomId(30) from the same stream, and a leaked cookie signature lets the attacker identify the correct state and startup offset.
Attack Vector
An unauthenticated attacker sends six POST requests to /~/api/loginSrp1 with the known admin username, collecting the hfs_http cookie payload (containing the numeric sid) and its hfs_http.sig signature from each response. After recovering the PRNG state and signing key offline, the attacker signs a synthetic session containing the admin username and calls administrative APIs such as get_config and set_config.
Impact
The forged cookie is accepted as an HFS administrator. Through the administrative server_code configuration the attacker can run JavaScript in the server process, which in the validated lab produced command execution as root inside the container and could lead to full host compromise. No credentials are required and no password is ever guessed.
Environment / Lab Setup
OS: Linux x86_64 (Docker or Docker Desktop/WSL2)
Target: rejetto/hfs:v3.2.0 (vulnerable) and rejetto/hfs:v3.2.1 (fixed)
Attacker: Same host, Python 3.10+, curl, Docker Compose
Tools: python3 stdlib, docker compose, curlSetup Steps
| |
Both images are digest-pinned and bind only to host loopback. The lab creates a synthetic administrator account because loginSrp1 must be invoked for an existing username; the password is neither known nor used.
Proof of Concept
Step-by-Step Reproduction
Start the disposable lab — verify.sh prepares per-variant config files, starts the vulnerable 3.2.0 and fixed 3.2.1 containers, and waits for the admin account.
Shell script1KEEP_LAB=1 ./verify.shCollect PRNG leaks — six unauthenticated loginSrp1 requests are issued for the admin account, recording the numeric sid and the signed hfs_http cookie.
Shell script1python3 cve-2026-61500-poc.py --target http://127.0.0.1:28182Recover the PRNG state and key — the PoC converts five consecutive doubles to their 53 visible bits, brute forces the 11 omitted low bits, and validates candidates against the observed cookie signature.
Forge the admin session — a session object for the admin user is signed with the recovered key and used to call get_config, confirming administrative access with HTTP 200.
Demonstrate server-side execution — set_config installs a small server_code module that writes a benign marker file in /data. Use
--commandonly in the owned loopback lab to run an explicit command instead.Shell script1 2python3 cve-2026-61500-poc.py --target http://127.0.0.1:28182 \ --command 'id > /data/cve-command-output.txt'Negative control — run the same PoC against the fixed 3.2.1 instance; it exits with status 3 because the login identifier is an opaque UUID.
Exploit Code
See cve-2026-61500-poc.py for the full implementation and verify.sh for the end-to-end harness.
| |
Expected Output
vulnerable_server_header=HFS 3.2.0 2026-07-05T10:05:41.000Z
collected_sids=0.6479234922590129,0.9311743632622538,...
prng_state_recovered=true key_offset=3
cookie_signing_key=[ephemeral lab value redacted]
forged_admin_probe_status=200 body={"version":"3.2.0"}
payload=write benign marker /data/cve-2026-61500-rce-marker-1234.txt
server_code_status=200 body={}
vulnerable_result=PASS forged admin session and executed benign server_code marker
not_vulnerable=login identifier is not a Math.random number ('[UUID redacted]'); target appears fixed
fixed_result=PASS opaque UUID login identifier stopped exploitationThe recorded command control produced uid=0(root) gid=0(root) groups=0(root) inside the official 3.2.0 container; see docs/example-output.txt and docs/e2e-results.json.
Detection & Indicators of Compromise
SIEM / IDS Rule (example):
alert http any any -> $HOME_NET any (msg:"Possible HFS CVE-2026-61500 session forgery"; flow:to_server,established; http.method; content:"POST"; http.uri; content:"/~/api/loginSrp1"; threshold:type both, track by_src, count 6, seconds 60; sid:202661500; rev:1;)Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade to HFS 3.2.1 or later, which uses 32 random bytes for the cookie signing key and replaces the numeric login identifier with a random UUID. |
| Workaround | Supply an explicit strong COOKIE_SIGN_KEYS value; rotate cookies and audit sessions while the upgrade is pending. |
| Config Hardening | Restrict administrative API access to trusted networks, monitor configuration changes, and avoid exposing HFS management interfaces to the internet. |
References
Notes
Verdict: genuine, non-malicious exploit PoC with a reproducible end-to-end lab. The upstream run on 2026-09-26 validated the vulnerable image (forged admin get_config returned 200 and the marker was written) and the fixed image (no forgery attempted). The publication build accepts loopback HTTP targets only, which limits accidental misuse.
License: no license file or explicit license grant in the upstream repository; the README includes a legal notice limiting use to authorized research, defensive validation, and education.
Limitations: the PoC depends on HFS exposing a numeric Math.random sid for an existing account; a target that returns a UUID sid is already running the fixed build. The publication build refuses non-loopback targets and HTTPS, so the archived code cannot be pointed at a remote host without modification. The reverse-shell demonstration harness (demo.sh, record-demo.sh, lab/callback-server.py) was intentionally omitted; only the PoC, verification harness, lab configuration, and recorded evidence needed to reproduce the vulnerability were archived. The compose file still defines the unexposed callback service, which is not started by verify.sh and is not required for the archived chain. No exploit code was executed during archival.
| |