T1059.011 Splunk · SPL

Detect Lua in Splunk

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).

MITRE ATT&CK

Tactic
Execution
Technique
T1059 Command and Scripting Interpreter
Sub-technique
T1059.011 Lua
Canonical reference
https://attack.mitre.org/techniques/T1059/011/

SPL Detection Query

Splunk (SPL)
spl
(index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1 (Image="*\\lua*.exe" OR CommandLine="*.lua*"))
OR
(index=linux sourcetype="linux:auditd" type=EXECVE (a0="*lua*" OR a1="*.lua"))
| eval cmdline=coalesce(CommandLine, a0." ".a1." ".a2)
| eval OsExec=if(match(cmdline, "(os\.execute|io\.popen)"), 1, 0)
| eval NetworkActivity=if(match(cmdline, "(socket\.tcp|socket\.connect|http\.request)"), 1, 0)
| eval DynamicLoad=if(match(cmdline, "(loadstring|loadfile|dofile)"), 1, 0)
| eval SuspicionScore=OsExec*2 + NetworkActivity*2 + DynamicLoad
| where SuspicionScore > 0
| table _time, host, User, Image, cmdline, ParentImage, OsExec, NetworkActivity, DynamicLoad, SuspicionScore
| sort - SuspicionScore, - _time
medium severity low confidence

Detects suspicious Lua execution from both Windows (Sysmon) and Linux (auditd) sources. Evaluates for OS command execution, network activity, and dynamic code loading. Higher scoring for os.execute/io.popen and network socket usage as these indicate active system compromise.

Data Sources

Process: Process CreationCommand: Command ExecutionSysmon Event ID 1Linux auditd

Required Sourcetypes

XmlWinEventLog:Microsoft-Windows-Sysmon/Operationallinux:auditd

False Positives & Tuning

  • Game engines and applications with embedded Lua scripting
  • Network monitoring tools using Lua for packet inspection
  • Configuration management tools with Lua-based configurations
Download portable Sigma rule (.yml)

Other platforms for T1059.011


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Lua OS Command Execution

    Expected signal: Auditd: EXECVE record for lua with -e flag and os.execute in arguments. Child process event for whoami spawned by the Lua interpreter.

  2. Test 2Lua Network Socket Connection

    Expected signal: Auditd: EXECVE record for lua with socket.tcp in arguments. Network connection attempt to 127.0.0.1:4444.

  3. Test 3Lua Dynamic Code Loading

    Expected signal: Auditd: EXECVE record for lua with loadstring in arguments. The dynamically loaded code is executed at runtime.

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