Math.random() Is Not a Secret: Session Key Lessons From the Check Point Intrusion Campaign GreyNoise detailed an intrusion campaign, tracked as GT13, in which an attacker predicted the Math.random()-based session signing key of a Rejetto HFS 3 file server (CVE-2026-61500, CVSS 9.3), forged an admin cookie, and used the box as a relay to control and steal data from 24 Check Point Security Management Servers at 22 organizations. Horizon3.ai, which found the flaw using Anthropic's Mythos model, traced the chain through HFS's use of Math.random() for cookie signing keys and a login handshake that leaked generator outputs, plus an admin-defined server_code feature enabling remote code execution. GreyNoise did not attribute GT13 to a known group and said it could not determine how attackers first gained access to the Check Point servers. The attacker did not guess the admin password. They predicted the random number generator. That is the first step in an intrusion campaign described this week by GreyNoise, a threat intelligence company. The attacker started a few logins on a small file server, collected the "random" values it sent back, and worked out the server's secret cookie key from them. With that key they made their own admin cookie and took over the server. They then used that server as a relay to control and steal data from 24 Check Point Security Management Servers at 22 organizations. Below: the two weak points in that chain, why Math.random can be predicted, and fixes in Node.js, Java and Python, plus checklists for Check Point and HFS admins. A note on sources: everything below comes from the GreyNoise report, the Horizon3.ai write-up, vendor advisories and the HFS source code, all linked inline. I have not reproduced the attack. The token samples are standard library calls checked against the official docs. GreyNoise runs a large network of sensors that attract attackers. In its report on the campaign https://www.greynoise.io/blog/check-point-security-management-servers-intrusion-campaign , which it tracks as GT13 GreyNoise Threat 13 , the company says: GreyNoise does not attribute GT13 to any known group. It also says the attacker already had access to the Check Point servers before compromising the relay box, and it could not determine how that first access happened. Keep that in mind: the two bugs below explain how the attacker built the relay and ran commands, not necessarily how it first got in. The Hacker News thread https://news.ycombinator.com/item?id=50630594 had 269 points when this was written. The relay box ran Rejetto HFS HTTP File Server , an open-source file-sharing tool. Version 3 is TypeScript on Node.js with the Koa web framework. The bug is CVE-2026-61500 https://www.cve.org/CVERecord?id=CVE-2026-61500 , rated 9.3 critical , and it affects HFS 3.0.0 through 3.2.0. Horizon3.ai found it using Anthropic's Mythos model and described the chain in a September 30 write-up https://horizon3.ai/attack-research/disclosures/anthropic-mythos-rejetto-hfs-rce/ . It has three parts. The signing key came from Math.random . Koa signs session cookies with a list of keys. A signed cookie cannot be changed by the client without breaking the signature, so the key must stay secret. If the COOKIE SIGN KEYS environment variable was not set, HFS made a key at startup like this from the vulnerable version of src/index.ts https://github.com/rejetto/hfs/blob/5a0c3962f0a70adac7a488101afe5492f50c2085/src/index.ts : js 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 } And randomId was built on Math.random : 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 } So a 30-character key is just three Math.random outputs, taken one after another when the process starts. The login handshake leaked more Math.random outputs. During login, the loginSrp1 endpoint set sid = Math.random and stored it in the session. Koa session cookies are base64-encoded JSON. They are signed, but not encrypted, so anyone can decode their own cookie and read the exact number. Getting that cookie only needed a valid username, not a password. The server could run admin-defined JavaScript. HFS has a documented server code feature that lets an admin add server-side JavaScript. Once you are admin, that is remote code execution. Put together: request a login a few times, collect the leaked numbers, rebuild the generator's internal state, step it backwards to the three outputs used at startup, rebuild the key, and sign a cookie that says you are admin . Horizon3's exploit sampled the leaking endpoint 12 times and used Z3, a free constraint solver from Microsoft, to recover the state. You can even check a guessed key offline, because your own legitimately issued cookie carries a signature made with the real key. GreyNoise saw exactly this pattern. On October 2 at 13:17 UTC the actor started sending login requests to the HFS server. At 13:19 UTC, about two minutes later, admin requests with forged cookies arrived. The forged session included allow session ip change:true , so the cookie worked from any IP address. Three days later the actor used the same route to add an SSH key to /root/.ssh/authorized keys . The fix shipped in HFS v3.2.1 https://github.com/rejetto/hfs/releases/tag/v3.2.1 on July 13, 2026. The current code looks like this src/index.ts on main https://github.com/rejetto/hfs/blob/main/src/index.ts : js const keys = process.env.COOKIE SIGN KEYS?.split ',' || randomBytes 32 .toString 'base64url' // cookie signatures need randomness that cannot be reconstructed from observable Math.random output The login handshake now uses randomUUID from node:crypto for sid . Both changes swap a predictable generator for Node's cryptographically secure one. The timing matters too. The patch was out in July. A public proof-of-concept appeared in late September, and BleepingComputer reported https://www.bleepingcomputer.com/news/security/rejetto-hfs-servers-now-actively-scanned-for-critical-rce-flaw scanning for the flaw on October 5. The server GreyNoise watched was still unpatched on October 2. Math.random is a pseudo-random number generator PRNG . It keeps a small internal state, runs a fixed formula on it, and gives you a number. Same state in, same numbers out. In V8, the JavaScript engine inside Chrome and Node.js, that formula is xorshift128+. The V8 team's blog post https://v8.dev/blog/math-random explains that it uses 128 bits of internal state, and then warns: "even though xorshift128+ is a huge improvement over MWC1616, it is still not cryptographically secure." Two facts make that warning real: A cryptographically secure PRNG CSPRNG is designed so that seeing outputs tells you nothing useful about other outputs. Secrets need that property, and Math.random does not have it. MDN says it directly https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global Objects/Math/random : Math.random does not "provide cryptographically secure random numbers. Do not use them for anything related to security." This is a known weakness class with its own number, CWE-338 https://cwe.mitre.org/data/definitions/338.html use of a cryptographically weak PRNG . What made CVE-2026-61500 exploitable was the combination: a weak generator, plus the same generator's raw output handed to anyone who asked. The same rule applies outside JavaScript. The Java docs for java.util.Random https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Random.html say: "Instances of java.util.Random are not cryptographically secure. Consider instead using SecureRandom." The Python random module https://docs.python.org/3/library/random.html says its generators "should not be used for security purposes" and points to the secrets module. With the relay box in place, the attacker tunneled into a victim network GreyNoise calls it Victim A using Chisel. Over that tunnel they used a script for CVE-2026-16232 https://www.cve.org/CVERecord?id=CVE-2026-16232 , an authentication bypass in the Check Point SmartConsole login process. GreyNoise says the actor launched over 100 management tasks on multiple Check Point Management Servers. These included copying the firewall database and the internal certificate authority CA , minting a new certificate named pivot.p12 , and unloading security policies, which would disable the firewall. On October 26 a bulk certificate task went out to all 24 compromised servers. It failed, but the result files sent back to the relay box contained victim IP addresses, which let GreyNoise and government partners notify many victims. Check Point disclosed CVE-2026-16232 on July 22, 2026, in a security advisory https://blog.checkpoint.com/security/security-advisory-action-required-active-exploitation-of-check-point-smartconsole-authentication-bypass-cve-2026-16232/ , and said it was already exploited in the wild, affecting "a handful of customers." Its support article sk185169 https://support.checkpoint.com/results/sk/sk185169 lists the details: Rapid7's technical analysis https://www.rapid7.com/blog/post/ra-check-point-smartconsole-authentication-bypass-technical-analysis-cve-2026-16232/ found the root cause. The Java login service accepted an identity a SIC distinguished name, Check Point's certificate-based name for a management component that the caller simply typed into the request. It should have used the identity from the certificate the caller actually presented. An attacker could read the server's own name during the unauthenticated setup step, send it back, and be treated as a trusted internal application. Rapid7 also found that an unrestricted Trusted Clients setting was the default in its testing. The patch uses the certificate's name for remote callers and rejects mismatches. The two bugs look different, but they share one root problem: the server trusted a value the attacker could see or set. In both cases the right value was nearby crypto.randomBytes , the peer certificate's name , and the code took the easier one. When you review code that handles keys, tokens or identities, ask one question about each value: could the other side have seen it or chosen it? If yes, it is not a secret and it is not proof. The OWASP Session Management Cheat Sheet https://cheatsheetseries.owasp.org/cheatsheets/Session Management Cheat Sheet.html sets the baseline: session IDs need "at least 64 bits of entropy" and must come from a CSPRNG. The examples below use 32 bytes 256 bits , which is more than enough and the same size HFS now uses. Node.js. Use the built-in crypto module https://nodejs.org/api/crypto.html . The docs describe randomBytes as "cryptographically strong pseudorandom data", and randomUUID also uses a cryptographic generator. js import { randomBytes, randomUUID } from 'node:crypto' // A signing key or API token: 32 random bytes, URL-safe text const signingKey = randomBytes 32 .toString 'base64url' // A session or request id const sessionId = randomUUID In the browser, use crypto.getRandomValues or crypto.randomUUID from the Web Crypto API instead of Math.random . Java. Use java.security.SecureRandom , and share one instance instead of creating one per call. python import java.security.SecureRandom; import java.util.Base64; public final class Tokens { private static final SecureRandom RNG = new SecureRandom ; private Tokens {} public static String newToken { byte bytes = new byte 32 ; RNG.nextBytes bytes ; return Base64.getUrlEncoder .withoutPadding .encodeToString bytes ; } } Spring Session and servlet containers generate session IDs for you. The rule still applies to anything you create by hand: reset links, invite codes, API keys and one-time tokens. Python. Use the secrets module https://docs.python.org/3/library/secrets.html . python import secrets token = secrets.token urlsafe 32 32 random bytes, URL-safe text Beyond the generator itself, four habits close the gaps behind this bug: COOKIE SIGN KEYS was not set. A CSPRNG-generated key from a secret manager removes that path. Koa accepts a list of keys, so you can rotate by adding a new key while keeping the old one for a while. grep -rnE "Math\.random\ |new Random\ |random\.random\ " src/ . Most hits are harmless shuffling, test data . Look closely at any hit near token, key, secret, session, nonce or reset. From Check Point's sk185169 and the GreyNoise report: newpayapp.com and subdomains data-zt , api-zt and 2ev5 , the user agent strings Mozilla/5.0 X11; Linux x86 64 research and Mozilla/5.0 research , and a long list of ExpressVPN IP addresses. One victim's output showed /usr/lib/.libproc.so registered in /etc/ld.so.preload , which may indicate an implant. Check for that file and for unknown keys in /root/.ssh/authorized keys . server code scripts and new SSH keys. There are two AI claims in this story, and they are different. The first is about finding the bug. Horizon3 says Mythos spotted the weak key and the separate leak, linked them, and wrote a working exploit. The researchers wrote that they "do not recall ever seeing an SMT solver being used to attack a cryptographic flaw like this in a real application." Their point is that bugs which used to be too slow or too mathematical to weaponize are now cheap to turn into exploits. The second is about the attacker. GreyNoise believes GT13 used LLMs and agent systems, partly because of odd gaps in the timeline, such as the actor gaining SSH access and then not using it for two weeks. That is GreyNoise's assessment, not something it proves in the report. The defensive lesson does not depend on either claim. Math.random has never been safe for secrets, and the docs for JavaScript, Java and Python all say so. What has changed is how quickly someone will notice. If a weak generator sits next to a secret in your code, assume an automated tool will find it soon. Have you ever found Math.random or java.util.Random guarding a token in a codebase you worked on, and how did the team decide what to rotate after the fix?