LuaRocks Security Incident September 2026

22 points by derp_alert


technomancy

Rockspecs are Lua files. When a rockspec is uploaded, LuaRocks.org runs it in a restricted environment to read the package’s name and version. The function used to load it accepted precompiled LuaJIT bytecode as well as Lua source.

It feels like 60-70% of the time I read about a security problem in a Lua program, this is the root cause. It's very frustrating because the load function is used to load textual code 99% of the time, but then occasionally people want to use it for bytecode as well. Loading untrusted text is safe and works great, but loading bytecode from an untrusted source is not safe.

The default "mode" argument for load is "bt", meaning "accept bytecode or text". If the default mode were changed to "t" and so it would accept only text unless the caller went out of their way to specify they also want bytecode would make so many of these problems disappear. It's extra frustrating because of how simple it would be to fix the root cause in Lua itself.