|
| 1 | +[metadata] |
| 2 | +creation_date = "2025/12/01" |
| 3 | +integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"] |
| 4 | +maturity = "production" |
| 5 | +updated_date = "2025/12/01" |
| 6 | + |
| 7 | +[rule] |
| 8 | +author = ["Elastic"] |
| 9 | +description = """ |
| 10 | +This rule detects the creation of pods or containers that execute suspicious commands often associated with persistence or |
| 11 | +privilege escalation techniques. Attackers may use container orchestration tools like kubectl or container runtimes like |
| 12 | +docker to create pods or containers that run shell commands with arguments that indicate attempts to establish persistence |
| 13 | +(e.g., modifying startup scripts, creating backdoors). |
| 14 | +""" |
| 15 | +from = "now-9m" |
| 16 | +index = [ |
| 17 | + "auditbeat-*", |
| 18 | + "endgame-*", |
| 19 | + "logs-auditd_manager.auditd-*", |
| 20 | + "logs-crowdstrike.fdr*", |
| 21 | + "logs-endpoint.events.process*", |
| 22 | + "logs-sentinel_one_cloud_funnel.*", |
| 23 | +] |
| 24 | +language = "eql" |
| 25 | +license = "Elastic License v2" |
| 26 | +name = "Pod or Container Creation with Suspicious Command-Line" |
| 27 | +risk_score = 47 |
| 28 | +rule_id = "c595363f-52a6-49e1-9257-0e08ae043dbd" |
| 29 | +severity = "medium" |
| 30 | +tags = [ |
| 31 | + "Domain: Endpoint", |
| 32 | + "Domain: Container", |
| 33 | + "OS: Linux", |
| 34 | + "Use Case: Threat Detection", |
| 35 | + "Tactic: Execution", |
| 36 | + "Tactic: Privilege Escalation", |
| 37 | + "Tactic: Persistence", |
| 38 | + "Data Source: Elastic Defend", |
| 39 | + "Data Source: Elastic Endgame", |
| 40 | + "Data Source: Auditd Manager", |
| 41 | + "Data Source: Crowdstrike", |
| 42 | + "Data Source: SentinelOne", |
| 43 | +] |
| 44 | +timestamp_override = "event.ingested" |
| 45 | +type = "eql" |
| 46 | +query = ''' |
| 47 | +process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and ( |
| 48 | + (process.name == "kubectl" and process.args == "run" and process.args == "--restart=Never" and process.args == "--") or |
| 49 | + (process.name in ("docker", "nerdctl", "ctl") and process.args == "run") |
| 50 | +) and |
| 51 | +process.args in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and |
| 52 | +process.command_line like~ ( |
| 53 | + "*atd*", "*cron*", "*/etc/rc.local*", "*/dev/tcp/*", "*/etc/init.d*", "*/etc/update-motd.d*", "*/etc/ld.so*", "*/etc/sudoers*", "*base64 *", |
| 54 | + "*/etc/profile*", "*/etc/ssh*", "*/home/*/.ssh/*", "*/root/.ssh*" , "*~/.ssh/*", "*autostart*", "*xxd *", "*/etc/shadow*", "*./.*", |
| 55 | + "*import*pty*spawn*", "*import*subprocess*call*", "*TCPSocket.new*", "*TCPSocket.open*", "*io.popen*", "*os.execute*", "*fsockopen*", |
| 56 | + "*disown*", "* ncat *", "* nc *", "* netcat *", "* nc.traditional *", "*socat*", "*telnet*", "*/tmp/*", "*/dev/shm/*", "*/var/tmp/*", |
| 57 | + "*/boot/*", "*/sys/*", "*/lost+found/*", "*/media/*", "*/proc/*", "*/var/backups/*", "*/var/log/*", "*/var/mail/*", "*/var/spool/*" |
| 58 | +) |
| 59 | +''' |
| 60 | + |
| 61 | +[[rule.threat]] |
| 62 | +framework = "MITRE ATT&CK" |
| 63 | + |
| 64 | +[[rule.threat.technique]] |
| 65 | +id = "T1059" |
| 66 | +name = "Command and Scripting Interpreter" |
| 67 | +reference = "https://attack.mitre.org/techniques/T1059/" |
| 68 | + |
| 69 | +[[rule.threat.technique.subtechnique]] |
| 70 | +id = "T1059.004" |
| 71 | +name = "Unix Shell" |
| 72 | +reference = "https://attack.mitre.org/techniques/T1059/004/" |
| 73 | + |
| 74 | +[[rule.threat.technique]] |
| 75 | +id = "T1609" |
| 76 | +name = "Container Administration Command" |
| 77 | +reference = "https://attack.mitre.org/techniques/T1609/" |
| 78 | + |
| 79 | +[rule.threat.tactic] |
| 80 | +id = "TA0002" |
| 81 | +name = "Execution" |
| 82 | +reference = "https://attack.mitre.org/tactics/TA0002/" |
| 83 | + |
| 84 | +[[rule.threat]] |
| 85 | +framework = "MITRE ATT&CK" |
| 86 | + |
| 87 | +[[rule.threat.technique]] |
| 88 | +id = "T1611" |
| 89 | +name = "Escape to Host" |
| 90 | +reference = "https://attack.mitre.org/techniques/T1611/" |
| 91 | + |
| 92 | +[rule.threat.tactic] |
| 93 | +id = "TA0004" |
| 94 | +name = "Privilege Escalation" |
| 95 | +reference = "https://attack.mitre.org/tactics/TA0004/" |
| 96 | + |
| 97 | +[[rule.threat]] |
| 98 | +framework = "MITRE ATT&CK" |
| 99 | + |
| 100 | +[[rule.threat.technique]] |
| 101 | +id = "T1053" |
| 102 | +name = "Scheduled Task/Job" |
| 103 | +reference = "https://attack.mitre.org/techniques/T1053/" |
| 104 | + |
| 105 | +[[rule.threat.technique.subtechnique]] |
| 106 | +id = "T1053.002" |
| 107 | +name = "At" |
| 108 | +reference = "https://attack.mitre.org/techniques/T1053/002/" |
| 109 | + |
| 110 | +[[rule.threat.technique.subtechnique]] |
| 111 | +id = "T1053.003" |
| 112 | +name = "Cron" |
| 113 | +reference = "https://attack.mitre.org/techniques/T1053/003/" |
| 114 | + |
| 115 | +[rule.threat.tactic] |
| 116 | +id = "TA0003" |
| 117 | +name = "Persistence" |
| 118 | +reference = "https://attack.mitre.org/tactics/TA0003/" |
0 commit comments