Suspicious Lua Command Execution
Description
This rule monitors for suspicious Lua command executions by detecting the start of a Lua process with a command line argument that contains keywords commonly used by attackers to execute malicious code. These command line arguments include operations to execute code, create subprocesses, and encode or decode data.
Query · eql
process where event.type == "start" and event.action == "exec" and
process.executable like ("/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*") and
process.args == "-e" and process.command_line like~ (
"*os.execute(*", "*io.popen(*", "*load(*", "*loadstring(*", "*dofile(*",
"*package.loadlib(*", "*base64.decode(*", "*base64.encode(*", "*zlib.inflate(*",
"*zlib.deflate(*", "*zlib.decompress(*", "*zlib.compress(*", "*socket.bind(*",
"*socket.connect(*", "*socket.receive(*", "*socket.send(*", "*socket.tcp(*",
"*socket.udp(*", "*socket.listen(*", "*socket.accept(*", "*net.http.request(*",
"*net.http.get(*", "*net.http.post(*", "*http.request(*", "*http.get(*", "*http.post(*"
) and not (
process.parent.name in ("make", "configure") or
process.command_line in ("lua -e require('cjson')", "lua -e require('socket')") or
process.command_line like "*no_such_lib*"
)