With a colleague of mine we have spent a few weeks reviewing how securely are mods implemented. We couldn't not take a look at Factorio, since it seems to be so well engineered
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Loading untrusted bytecode is a huge issue in the Lua world, because there used to be a bytecode verifier to check that it was well-formed but it has been removed during the transition from Lua 5.1 to Lua 5.2. It such a big issue, that in 2012 the developers of Roblox have decided to remove the ability to load bytecode from their modding interface [0].
We have tried to exploit the Lua implementation within Factorio using well known Lua tricks (almost a decade old for some of them), however we were not successful (mostly because our lack of time). However theoretically it remains possible to exploit the Lua engine within Factorio to escalate privileges and run arbitrary code through modding.
Would you consider removing the load() function ?
We have documented our attempts on github [1].
[0] : https://blog.roblox.com/2012/08/bye-bye-bytecode/
[1] : https://github.com/gbip/lua_attack