79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

Rejetto HFS Session Forgery to RCE, Exploited (CVE-2026-61500)

Rejetto HFS 3.0.0 to 3.2.0 builds its cookie key from Math.random(), so an unauthenticated attacker can forge an admin session and run code. Fixed in 3.2.1.

TL;DR

  • Rejetto HFS 3.0.0 to 3.2.0 derives its cookie key from Math.random(), and its login endpoint leaks outputs from the same generator. Horizon3 found the chain with Anthropic's Mythos and published it on 2026-09-30.
  • Any internet-facing HFS 3.0.0 to 3.2.0 with a login-enabled account is exposed. HFS has 4,033 GitHub stars, 381 forks and 128,239 Docker Hub pulls as of 2026-12-01.
  • VulnCheck rates it CVSS v4.0 9.3 Critical (CVSS v3.1 9.8). GreyNoise observed exploitation from 2026-10-02, and CISA added it to KEV on 2026-11-30 with a due date of 2026-12-03.
  • Upgrade to 3.2.1 or later, preferably 3.4.2, then rotate the HFS admin password and every secret the server could read. See "How do I fix it?" for the workaround.

Am I affected?

You are exposed when all of these conditions hold:

  • HFS 3.0.0 through 3.2.0 is installed.
  • COOKIE_SIGN_KEYS is unset, so HFS derives the Koa signing key from randomId(30).
  • At least one login-enabled account exists. The built-in admin account is enough.
  • The HFS interface is reachable from the attacker's network.

The CVE record lists 3.0.0 through 3.2.0 as affected. The first fixed release is 3.2.1. The latest release is 3.4.2 from 2026-11-24.

Branch Affected versions Fixed version
3.0.x 3.0.0 and later 3.0.x releases 3.2.1 or later
3.1.x 3.1.0 and later 3.1.x releases 3.2.1 or later
3.2.x 3.2.0 3.2.1 or later
3.3.x and 3.4.x None Not affected

Check the version of a native installation:

./hfs --version

Check the version inside the official Docker image:

docker exec <container> /opt/hfs/hfs --version

Check whether the signing key comes from the environment:

printenv COOKIE_SIGN_KEYS

For Docker, read the container environment:

docker inspect <container> --format '{{range .Config.Env}}{{println .}}{{end}}' | grep COOKIE_SIGN_KEYS

An empty result means HFS generated the key from Math.random. A strong, secret value closes the key-recovery path in this chain. The login endpoint still leaks sid values and still distinguishes valid from invalid usernames, so upgrade in either case.

Check the config for accounts that can log in:

grep -n "^accounts:" -A20 /path/to/hfs/config.yaml

How do I fix it?

Upgrade to 3.2.1 or later. The latest release is 3.4.2.

  1. Download the release asset for your platform and unpack it:
curl -L -o hfs.zip https://github.com/rejetto/hfs/releases/download/v3.4.2/hfs-linux-x64-3.4.2.zip
unzip -o hfs.zip
./hfs --version

Use hfs-linux-arm64, hfs-mac-x64, hfs-mac-arm64 or hfs-windows-x64 for the other platforms.

  1. Stop HFS, replace the binary, and start it again with the same working directory and config.
  2. For Docker, pull rejetto/hfs:v3.4.2 and recreate the container. A pulled image alone does not replace the running container.
docker pull rejetto/hfs:v3.4.2
docker stop <container>
docker rm <container>
docker run -d --name <container> -p 80:80 -v /path/to/data:/data rejetto/hfs:v3.4.2
  1. Confirm the new version with the command in "Am I affected?".
  2. Rotate the HFS admin password and every credential, API key and SSH key the HFS process could read. An attacker with the forged admin session can read the config and run code.

If you cannot upgrade, use this workaround:

  1. Generate a long random value and pass it to HFS as COOKIE_SIGN_KEYS before the process starts:
export COOKIE_SIGN_KEYS="$(openssl rand -base64 48)"
./hfs

For Docker, pass the value with -e COOKIE_SIGN_KEYS="$(openssl rand -base64 48)".

  1. Restart HFS so it reads the new key. Existing sessions become invalid.
  2. Restrict the admin interface to a trusted network with admin_net, and do not expose HFS directly to the internet.

The environment variable closes the key-recovery path because the signing key no longer comes from Math.random. It does not remove the sid leak or the username oracle, so upgrade as soon as you can.

What is the root cause?

HFS is a Node.js file server built on Koa. Koa signs every session cookie with a key from app.keys, and HFS generated that key with its own randomId() helper. The helper is built on Math.random().

// src/cross.ts, v3.2.0
export function randomId(len = 10): string {
    if (len > 10)
        return randomId(10) + randomId(len - 10)
    return Math.random()
        .toString(36)
        .substring(2, 2+len)
        .replace(/l/g, 'L'); // avoid confusion reading l1
}

The startup key used the same helper, and the fallback ran whenever COOKIE_SIGN_KEYS was unset:

// src/index.ts, v3.2.0
const keys = process.env.COOKIE_SIGN_KEYS?.split(',')
    || [randomId(30)] // randomness at start gives some extra security, btu also invalidates existing sessions
export const app = new Koa({ keys })

The second half of the chain is the login handshake. The first step of the SRP login creates a session identifier and stores it in the session object:

// src/api.auth.ts, v3.2.0
const sid = Math.random()
ongoingLogins[sid] = srpServer
setTimeout(()=> delete ongoingLogins[sid], 60_000)
ctx.session.loggingIn = { username, sid } // temporarily store until process is complete

Koa session cookies are base64-encoded JSON signed with the key, not encrypted. The client can decode its own cookie and read the exact 52-bit double in loggingIn.sid. Every successful loginSrp1 call therefore returns one raw output of the same Math.random() stream that produced the signing key.

V8, the JavaScript engine in Node.js, implements Math.random() with xorshift128+. The algorithm is fast and non-cryptographic, and its state is invertible. A handful of consecutive outputs is enough to recover the internal state.

The state can then be stepped backwards to the three outputs consumed by randomId(30) when the process started. That reconstructs the signing key, and the attacker's own cookie provides an offline check against the HMAC.

How is it exploited?

  1. Find a valid, login-enabled username. A POST to /~/api/loginSrp1 with a known account returns 200 and an SRP challenge. An unknown account returns 401. The built-in admin account is the usual target.
  2. Read loggingIn.sid from the session cookie in each 200 response. Horizon3's exploit samples 12 login responses.
  3. Feed the recovered doubles into a solver for the xorshift128+ state. Horizon3 used the Z3 theorem prover.
  4. Step the state backwards to the process start, reconstruct the three outputs used by randomId(30), and verify the candidate key against the HMAC of the attacker's own cookie.
  5. Sign a session cookie for admin with the recovered key. The cookie carries the admin username, the current timestamp and allow_session_ip_change: true.
  6. Send the forged cookie to the HFS API. prepareState accepts the username because the server-side revocation map is empty by default. The IP binding is skipped because the attacker signed allow_session_ip_change into the cookie.
  7. Use the admin API to set server_code or to install a plugin with a custom endpoint. HFS evaluates that JavaScript with new Function and runs it in the Node.js process. That is arbitrary code execution as the HFS user.

GreyNoise observed this chain in the wild. The actor used it to append an SSH key to /root/.ssh/authorized_keys, install a relay and run commands on the host.

Version 3.2.1 shipped on 2026-07-13, 81 days before GreyNoise observed the exploitation on 2026-10-02. The patch was public the whole time.

The fix shipped on 2026-07-13, but GreyNoise observed exploitation on 2026-10-02 and CISA added the CVE to KEV on 2026-11-30
Figure 1: From the 3.2.1 fix to the CISA KEV listing. Source: CVE record, Horizon3, GreyNoise and CISA KEV, checked December 1, 2026

How does the attack flow?

The chain turns two uses of one predictable generator into a forged admin cookie, and the admin API turns that cookie into code execution.

flowchart LR A["POST /~/api/loginSrp1
with a valid username"] --> B["Set-Cookie carries
sid from Math.random()"] B --> C["12 sids recover
xorshift128+ state"] C --> D["Step state back
to the startup key"] D --> E["Forge an admin
session cookie"] E --> F["prepareState accepts it
and skips the IP check"] F --> G["server_code runs
JavaScript as the HFS user"]

What can an attacker do?

An attacker who completes the chain gets full administrative control of HFS and can run arbitrary code as the user that runs the HFS process. The official Docker image starts HFS as root inside the container, and GreyNoise observed the actor write an SSH key to /root/.ssh/authorized_keys on the compromised host.

The impact includes:

  • Reading and writing every file the HFS process can reach.
  • Reading the HFS config, including other account credentials and plugin settings.
  • Adding server_code or a plugin that runs commands on every request or on a schedule.
  • Using the host as a relay for further intrusion, which is what GreyNoise observed.

The conditions are specific but common:

  • A login-enabled account must exist. The default admin account satisfies this.
  • The HFS API must be reachable from the attacker's network.
  • COOKIE_SIGN_KEYS must be unset, or the attacker must recover a key that was generated from Math.random.
  • No password is needed at any step.

Why does the fix work?

Version 3.2.1 removes both uses of Math.random() from the chain and closes the username oracle.

--- a/src/index.ts
+++ b/src/index.ts
@@
 const keys = process.env.COOKIE_SIGN_KEYS?.split(',')
-    || [randomId(30)] // randomness at start gives some extra security, btu also invalidates existing sessions
+    || [randomBytes(32).toString('base64url')] // cookie signatures need randomness that cannot be reconstructed from observable Math.random() output
 export const app = new Koa({ keys })
--- a/src/api.auth.ts
+++ b/src/api.auth.ts
@@
-        if (!account || !accountCanLogin(account)) { // TODO simulate fake account to prevent knowing valid usernames
+        if (account && !accountCanLogin(account)) {
             ctx.logExtra({ u: username })
             ctx.state.dontLog = false // log even if log_api is false
-            return new ApiError(HTTP_UNAUTHORIZED, account && accountIsDisabled(account) ? 'Account disabled' : undefined)
+            return unauthorized(accountIsDisabled(account) ? 'Account disabled' : undefined)
         }
-        if (failAllowNet(ctx, account))
-            return new ApiError(HTTP_UNAUTHORIZED)
+        if (account && failAllowNet(ctx, account))
+            return unauthorized()
         try {
-            const { srpServer, ...rest } = await srpServerStep1(account)
-            const sid = Math.random()
+            const { srpServer, ...rest } = await srpServerStep1(account || fakeSrpAccount(username))
+            const sid = randomUUID()
             ongoingLogins[sid] = srpServer

randomBytes reads from the operating system's cryptographic random source. randomUUID produces a version 4 UUID from the same source. Neither value can be predicted from other outputs. The fake account gives an unknown username a stable salt and verifier. Both are derived with HMAC-SHA-256 from a process secret, so step 1 no longer reveals whether the account exists.

The fix covers the full chain in this post. HFS 3.2.1 also carries unrelated security fixes, so apply the whole release rather than cherry-picking one change.

How do I check if I was compromised?

Start with the HFS access log. The default path is logs/access.log under the HFS working directory.

Look for a burst of step-1 logins from one address. A browser performs one step-1 login per sign-in, so a dozen in a short window is a lead:

grep -a "POST /~/api/loginSrp1" /path/to/hfs/logs/access.log \
  | awk '{print $1}' | sort | uniq -c | sort -nr | head

The access log records the User-Agent only when log_ua is enabled. If it is on, search for the string GreyNoise recorded during the HFS exploitation:

grep -aF "Mozilla/5.0 (X11; Linux x86_64) research" /path/to/hfs/logs/access.log

Check the HFS config for server_code and for plugins you did not install:

grep -n -A30 "^server_code:" /path/to/hfs/config.yaml
find /path/to/hfs/plugins -maxdepth 2 -type f -newermt "2026-10-01"

Check the host for the persistence GreyNoise observed. The actor appended an SSH key and created an exfiltration directory:

cat /root/.ssh/authorized_keys
ls -la /root/exfil /tmp/chisel 2>/dev/null

Search the HFS working directory and the exfiltration directory for the campaign domains:

grep -R -aE "newpayapp\.com|data-zt\.newpayapp\.com|api-zt\.newpayapp\.com|2ev5\.newpayapp\.com" /path/to/hfs /root/exfil 2>/dev/null

GreyNoise published the campaign domains, the User-Agent and 99 IP addresses. HFS does not log the sid value itself, so a failed attempt may leave only the repeated loginSrp1 requests.

Timeline

  • 2026-07-10: CVE-2026-61500 is reserved.
  • 2026-07-13: HFS 3.2.1 is released, and the CVE record is published.
  • 2026-09-30: Horizon3 publishes its technical analysis.
  • 2026-10-02: GreyNoise observes the HFS exploitation at 13:17 UTC.
  • 2026-11-23: GreyNoise publishes the campaign report.
  • 2026-11-30: CISA adds CVE-2026-61500 to KEV.

FAQ

Does upgrading to 3.2.1 fix the issue? Yes. Version 3.2.1 replaces both Math.random() uses with cryptographic randomness and closes the username oracle. The latest release is 3.4.2, and any later release includes the fix.

I set COOKIE_SIGN_KEYS. Am I still affected? The key-recovery path in this chain is closed because the signing key no longer comes from Math.random(). The login endpoint still leaks sid values and still distinguishes valid usernames, so upgrade as well.

Can an attacker forge a cookie without a valid username? No. The attacker needs one login-enabled username to make loginSrp1 return a session cookie with a sid. The default admin account is enough, and the response difference reveals which usernames exist.

Does the attacker need the admin password? No. The forged cookie bypasses the password check entirely. That is why rotating the admin password alone does not remove an attacker who already has the key.

Is HFS 2.x affected? No. CVE-2026-61500 is in the TypeScript rewrite that began with HFS 3.0.0. HFS 2.x had a different flaw, CVE-2024-23692.

What should I do first if the server was internet-facing? Upgrade, then treat the host as possibly compromised. Rotate the HFS admin password, every credential in the HFS config and every SSH key the process could read, and check for server_code, unknown plugins and added authorized keys.

References

  • Rejetto HFS 3.2.1 release notes, https://github.com/rejetto/hfs/releases/tag/v3.2.1 (checked December 1, 2026)
  • CVE-2026-61500 record, https://www.cve.org/CVERecord?id=CVE-2026-61500 (checked December 1, 2026)
  • VulnCheck advisory, Rejetto HFS session forgery via predictable signing key, https://www.vulncheck.com/advisories/rejetto-hfs-session-forgery-via-predictable-signing-key (checked December 1, 2026)
  • Horizon3, Anthropic Mythos and Rejetto HFS, https://horizon3.ai/attack-research/disclosures/anthropic-mythos-rejetto-hfs-rce/ (published 2026-09-30, updated 2026-11-10, checked December 1, 2026)
  • GreyNoise, active intrusion campaign against Check Point management servers, https://www.greynoise.io/blog/check-point-security-management-servers-intrusion-campaign (checked December 1, 2026)
  • CISA Known Exploited Vulnerabilities catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog (checked December 1, 2026)
  • HFS source at v3.2.0, randomId, https://github.com/rejetto/hfs/blob/v3.2.0/src/cross.ts (checked December 1, 2026)
  • HFS source at v3.2.0, session keys, https://github.com/rejetto/hfs/blob/v3.2.0/src/index.ts (checked December 1, 2026)
  • HFS source at v3.2.0, loginSrp1, https://github.com/rejetto/hfs/blob/v3.2.0/src/api.auth.ts (checked December 1, 2026)
  • HFS source at v3.2.1, loginSrp1 fix, https://github.com/rejetto/hfs/blob/v3.2.1/src/api.auth.ts (checked December 1, 2026)
  • HFS source at v3.2.1, session key fix, https://github.com/rejetto/hfs/blob/v3.2.1/src/index.ts (checked December 1, 2026)
  • HFS Dockerfile, https://github.com/rejetto/hfs/blob/v3.4.2/Dockerfile (checked December 1, 2026)
  • Rejetto HFS on Docker Hub, https://hub.docker.com/r/rejetto/hfs (checked December 1, 2026)
  • Rejetto HFS repository, https://github.com/rejetto/hfs (checked December 1, 2026)
  • Public proof of concept, https://github.com/aramosf/CVE-2026-61500 (checked December 1, 2026)

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog