Linux Restricted Shell Breakout via cpulimit Shell Evasion

Identifies Linux binary cpulimit abuse to break out from restricted environments by spawning an interactive system shell. The cpulimit utility is used to restrict the CPU usage of a process in cases of CPU or system load exceeding the defined threshold and the activity of spawning a shell is not a standard use of this binary by a user or system administrator. This can potentially indicate a malicious actor attempting to improve the capabilities or stability of their access.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2022/03/17"
 3deprecation_date = "2022/05/09"
 4maturity = "deprecated"
 5updated_date = "2022/05/09"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Identifies Linux binary cpulimit abuse to break out from restricted environments by spawning an interactive system
11shell. The cpulimit utility is used to restrict the CPU usage of a process in cases of CPU or system load exceeding the
12defined threshold and the activity of spawning a shell is not a standard use of this binary by a user or system
13administrator. This can potentially indicate a malicious actor attempting to improve the capabilities or stability of
14their access.
15"""
16from = "now-9m"
17index = ["logs-endpoint.events.*"]
18language = "eql"
19license = "Elastic License v2"
20name = "Linux Restricted Shell Breakout via cpulimit Shell Evasion"
21references = ["https://gtfobins.github.io/gtfobins/cpulimit/"]
22risk_score = 47
23rule_id = "0968cfbd-40f0-4b1c-b7b1-a60736c7b241"
24severity = "medium"
25tags = ["Elastic", "Host", "Linux", "Threat Detection", "Execution", "GTFOBins"]
26timestamp_override = "event.ingested"
27type = "eql"
28
29query = '''
30process where event.type == "start" and process.name in ("bash", "sh", "dash") and
31  process.parent.name == "cpulimit" and process.parent.args == "-f" and
32  process.parent.args in ("/bin/sh", "/bin/bash", "/bin/dash", "sh", "bash", "dash")
33'''
34
35
36[[rule.threat]]
37framework = "MITRE ATT&CK"
38[[rule.threat.technique]]
39id = "T1059"
40name = "Command and Scripting Interpreter"
41reference = "https://attack.mitre.org/techniques/T1059/"
42[[rule.threat.technique.subtechnique]]
43id = "T1059.004"
44name = "Unix Shell"
45reference = "https://attack.mitre.org/techniques/T1059/004/"
46
47
48
49[rule.threat.tactic]
50id = "TA0002"
51name = "Execution"
52reference = "https://attack.mitre.org/tactics/TA0002/"

References

Related rules

to-top