Linux Restricted Shell Breakout via the vi command

Identifies Linux binary find abuse to break out from restricted environments by spawning an interactive system shell. The vi/vim editor is the standard text editor in Linux distributions, and the activity of spawning a shell is not a standard use of this binary by a user or system administrator. This could 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/03"
 3deprecation_date = "2022/05/09"
 4maturity = "deprecated"
 5updated_date = "2022/05/09"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10Identifies Linux binary find abuse to break out from restricted environments by spawning an interactive system shell.
11The vi/vim editor is the standard text editor in Linux distributions, and the activity of spawning a shell is not a
12standard use of this binary by a user or system administrator. This could potentially indicate a malicious actor
13attempting 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 the vi command"
20references = ["https://gtfobins.github.io/gtfobins/vi/"]
21risk_score = 47
22rule_id = "89583d1b-3c2e-4606-8b74-0a9fd2248e88"
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.parent.name in ("vi", "vim") and process.parent.args == "-c" and process.parent.args in (":!/bin/bash", ":!/bin/sh", ":!bash", ":!sh") and process.name in ("bash", "sh")
30'''
31
32
33[[rule.threat]]
34framework = "MITRE ATT&CK"
35[[rule.threat.technique]]
36id = "T1059"
37name = "Command and Scripting Interpreter"
38reference = "https://attack.mitre.org/techniques/T1059/"
39[[rule.threat.technique.subtechnique]]
40id = "T1059.004"
41name = "Unix Shell"
42reference = "https://attack.mitre.org/techniques/T1059/004/"
43
44
45
46[rule.threat.tactic]
47id = "TA0002"
48name = "Execution"
49reference = "https://attack.mitre.org/tactics/TA0002/"

References

Related rules

to-top