LuaRocks Patches a Bytecode Flaw Attackers Used for Six Weeks
Security / news
LuaRocks Patches a Bytecode Flaw Attackers Used for Six Weeks
An independent researcher's writeup, published a day after the fix, names the LuaJIT instruction that let a crafted package listing read and write server memory.
An attacker who could upload a package listing to LuaRocks.org needed no other access to run code on the site's own server, LuaRocks said, describing a bytecode flaw fixed on Sept. 26 that had already been exploited for six weeks before anyone reported it.
The Lua package registry said it received the report on Sept. 25, coordinated through the U.S. Cybersecurity and Infrastructure Security Agency, and shipped a fix the next day. It thanked the researcher who reported the issue without naming them, and its incident page does not mention a CVE identifier.
How a package listing became a remote shell
LuaRocks parses an uploaded rockspec, the file that declares a package's name and version, by running it through Lua's loadstring function inside a sandbox built with setfenv and an empty environment. The parser never told loadstring to accept text only, so a file could contain precompiled Lua bytecode instead of source. On LuaJIT and Lua 5.1, bytecode is not verified, which means a hand-built file can contain instructions that read and write memory outside what the sandbox intended to expose.
A researcher's writeup names the instruction, a day after the fix
Vhyrro, a developer who maintains the Lua sandboxing project Lux and an alternative rocks host called Luanox, published a technical writeup on Sept. 27 crediting the bug to LuaJIT's KNUM instruction, which copies eight bytes into a register with no type check. Patched bytecode using KNUM let Vhyrro read tagged values forward from a script's constants table, locate the package.loaded table that references every loaded function, and pivot through debug.getfenv() to reach the global environment and call loadstring() outside the sandbox. Vhyrro said the approach took about a month of failed attempts, writing that "I had to fail 99 times over the span of a month before the 100th attempt worked." LuaRocks has not said whether Vhyrro is the same person credited in its own incident report.
Six weeks of activity before the report
| Date (2026) | Event |
|---|---|
| July 9 | First shell commands run on the server |
| Aug. 7 | Remote shell attempt; three malicious packages published |
| Aug. 16 and Aug. 20 | Hundreds of automated exploit attempts via the upload API |
| Sept. 25 | Report received, coordinated through CISA |
| Sept. 26 | Fix shipped; credentials revoked |
The three packages the attackers published, named bcrcewon, 7e0b94029db0 and 7e0b9402f9c8, gave them a foothold to repeat the exploit without re-uploading a crafted rockspec each time.
What the intrusion exposed, and what it didn't touch
Because the flaw ran code inside the web server itself, LuaRocks treated everything that server could reach as exposed: usernames and email addresses, bcrypt password hashes, every API key, two-factor secrets, GitHub OAuth tokens tied to accounts, and session records including IP addresses. The registry moved to a newly built server and revoked every credential the old one held. It said a comparison against a public git mirror predating the first attack, plus a review of every upload between July 9 and Sept. 26, found no evidence that any existing package's contents were altered.
The second time LuaRocks has had to reset everything
This is not the registry's first full credential reset. In March 2019, LuaRocks disclosed that its API keys and password-reset tokens had been generated with Lua's math.random, seeded from a Unix timestamp, making them guessable rather than cryptographically random; it found no evidence that flaw was exploited. The September incident is the first LuaRocks has confirmed was actively used against it.
What LuaRocks is telling its users to do
LuaRocks revoked every API key and ended every session, so users need to log in again and generate new keys. It is urging users to change passwords used elsewhere, re-enable two-factor authentication, and, on LuaJIT or Lua 5.1, upgrade to LuaRocks 3.12 or later, the version that passes loadstring a text-only flag and rejects any file beginning with byte 27. Anyone who installed bcrcewon, 7e0b94029db0 or 7e0b9402f9c8 should treat that machine as compromised, LuaRocks said. Coverage of open-source registry security failures, including WSO2's mislabeled CISA catalog entry and the governance fights documented by OpenClaw's maintainers, suggests registries built by volunteers keep discovering the same lesson only after an intrusion forces it.
Sources
More in Security
- 01Java4Shell Scores 9.2 From Its Finder and 8.1 From OpenJDK, and Needs an AVX-512 CPUCalif says a 65-character Base64 string overwrites 62 bytes of Java heap and reaches code execution in Keycloak, Jenkins and Jira. A second security firm says the source shows only a crash.
- 02CISA Gave 9 of 16 November KEV Entries a Three-Day Deadline With Forensic Triage, and 7 Got 14 DaysThe catalog's own due-date and forensicTriage fields show two tiers under BOD 26-04. Sorting November's additions by tier shows which exploited bugs CISA treats as already-compromised-until-proven-otherwise.
- 03Project Zero Cuts Its Disclosure Deadline to 60 Days on Feb. 2, 2027, Then 30 in 2028Google's bug-hunting team is dropping the 30-day patch soak period and counting every deadline from the day it reports, citing AI-assisted exploitation.
- 04Google Finds exploit_agent Diffing Patches and Firing Exploits With No Operator in the LoopGTIG's November 16 tracker reports the first fully automated discovery-to-exploit pipeline it has seen, found on an exposed staging server, plus 22 zero-days in August.