Linux Restricted Shell Breakout via awk Commands

Identifies Linux binary awk abuse to breakout out of restricted shells or environments by spawning an interactive system shell. The awk utility is a text processing language used for data extraction and reporting tools and the activity of spawning shell is not a standard use of this binary for a user or system administrator. It indicates a potentially malicious actor attempting to improve the capabilities or stability of their access.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2022/02/24"
 3deprecation_date = "2022/05/09"
 4maturity = "deprecated"
 5updated_date = "2022/05/09"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Identifies Linux binary awk abuse to breakout out of restricted shells or environments by spawning an interactive system
11shell. The awk utility is a text processing language used for data extraction and reporting tools and the activity of
12spawning shell is not a standard use of this binary for a user or system administrator. It indicates a potentially
13malicious actor attempting to improve the capabilities or stability of their access.
14"""
15from = "now-9m"
16index = ["logs-endpoint.events.*"]
17language = "eql"
18license = "Elastic License v2"
19name = "Linux Restricted Shell Breakout via awk Commands"
20references = ["https://gtfobins.github.io/gtfobins/nawk/", "https://gtfobins.github.io/gtfobins/mawk/"]
21risk_score = 47
22rule_id = "10754992-28c7-4472-be5b-f3770fd04f2d"
23severity = "medium"
24tags = ["Elastic", "Host", "Linux", "Threat Detection", "Execution", "GTFOBins"]
25timestamp_override = "event.ingested"
26type = "eql"
27
28query = '''
29process where event.type == "start" and process.name in ("sh", "bash", "dash") and
30  process.parent.name in ("nawk", "mawk", "awk", "gawk") and process.parent.args : "BEGIN {system(*)}"
31'''
32
33
34[[rule.threat]]
35framework = "MITRE ATT&CK"
36[[rule.threat.technique]]
37id = "T1059"
38name = "Command and Scripting Interpreter"
39reference = "https://attack.mitre.org/techniques/T1059/"
40[[rule.threat.technique.subtechnique]]
41id = "T1059.004"
42name = "Unix Shell"
43reference = "https://attack.mitre.org/techniques/T1059/004/"
44
45
46
47[rule.threat.tactic]
48id = "TA0002"
49name = "Execution"
50reference = "https://attack.mitre.org/tactics/TA0002/"

References

Related rules

to-top