T1059.011

Lua

Adversaries may abuse Lua commands and scripts for execution. Lua is a cross-platform scripting and programming language primarily designed for embedded use in applications. Lua can be executed on the command-line via the standalone lua interpreter, via scripts (.lua), or from Lua-embedded programs. Adversaries may incorporate, abuse, or replace existing Lua interpreters to execute malicious code. Notable examples include EvilBunny (malware instrumented by Lua), Remsec/ProjectSauron (modular Lua-based APT), Line Runner (Cisco device implant using Lua), PoetRAT (Lua interpreter for Windows), and RedLine Stealer (Lua bytecode for evasion).

Microsoft Sentinel / Defender
kusto
let LuaPatterns = dynamic([
  "lua.exe", "lua5", "luajit", "luac",
  ".lua", "dofile(", "loadfile(", "loadstring(",
  "require(", "os.execute(", "io.popen(",
  "os.remove(", "os.rename(", "io.open(",
  "socket.tcp", "socket.connect",
  "http.request", "ltn12.pump"
]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any ("lua", "luajit", "luac") or ProcessCommandLine has_any (LuaPatterns)
| extend OsExec = ProcessCommandLine has_any ("os.execute(", "io.popen(")
| extend NetworkActivity = ProcessCommandLine has_any ("socket.tcp", "socket.connect", "http.request")
| extend DynamicLoad = ProcessCommandLine has_any ("loadstring(", "loadfile(", "dofile(")
| extend ScriptFromTemp = ProcessCommandLine has_any ("\\Temp\\", "/tmp/", "AppData")
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         OsExec, NetworkActivity, DynamicLoad, ScriptFromTemp
| sort by Timestamp desc
medium severity low confidence

Data Sources

Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents

False Positives

  • Game engines and applications with embedded Lua scripting (World of Warcraft, Roblox, Redis, Nginx)
  • Network monitoring tools using Lua for packet inspection (Wireshark, Nmap NSE scripts)
  • Configuration management tools with Lua-based configurations (OpenResty, Kong API Gateway)

Unlock Pro Content

Get the full detection package for T1059.011 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections