|
| 1 | +[metadata] |
| 2 | +creation_date = "2025/04/30" |
| 3 | +integration = ["endpoint"] |
| 4 | +maturity = "production" |
| 5 | +updated_date = "2025/04/30" |
| 6 | + |
| 7 | +[rule] |
| 8 | +author = ["Elastic"] |
| 9 | +description = """ |
| 10 | +This rule detects the creation of a symbolic link from a system binary to a suspicious and writable location. This |
| 11 | +activity may indicate an attacker's attempt to evade detection by behavioral rules that depend on predefined process |
| 12 | +parent/child relationships. By executing the symlinked variant of a binary instead of the original, the attacker aims to |
| 13 | +bypass these rules. Through the new_terms rule type, this rule can identify uncommon parent processes that may indicate the |
| 14 | +presence of a malicious symlink. |
| 15 | +""" |
| 16 | +from = "now-9m" |
| 17 | +index = [ |
| 18 | + "logs-endpoint.events.process*", |
| 19 | +] |
| 20 | +language = "kuery" |
| 21 | +license = "Elastic License v2" |
| 22 | +name = "System Binary Symlink to Suspicious Location" |
| 23 | +risk_score = 21 |
| 24 | +rule_id = "d19a2399-f8e2-4b10-80d8-a561ce9d24d1" |
| 25 | +severity = "low" |
| 26 | +tags = [ |
| 27 | + "Domain: Endpoint", |
| 28 | + "OS: Linux", |
| 29 | + "Use Case: Threat Detection", |
| 30 | + "Tactic: Defense Evasion", |
| 31 | + "Data Source: Elastic Defend", |
| 32 | +] |
| 33 | +timestamp_override = "event.ingested" |
| 34 | +type = "new_terms" |
| 35 | +query = ''' |
| 36 | +process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and |
| 37 | +process.parent.executable != null and ( |
| 38 | + (process.name == "ln") or |
| 39 | + (process.name == "busybox" and process.args == "ln") or |
| 40 | + (process.name == "cp" and process.args == "--symbolic-link") |
| 41 | +) and |
| 42 | +process.args like ( |
| 43 | + "/bin/*", "/sbin/*", "/usr/bin/*", "/usr/sbin/*", "/usr/local/bin/*", "/usr/local/sbin/*", |
| 44 | + "/lib/*", "/lib64/*", "/usr/lib/*", "/usr/lib64/*", "/usr/local/lib/*", "/usr/local/lib64/*" |
| 45 | +) and |
| 46 | +process.args like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/root/*", "/home/*", "/*/.*") |
| 47 | +
|
| 48 | +host.os.type:linux and event.category:process and event.type:start and event.action:exec and |
| 49 | +process.parent.executable:* and ( |
| 50 | + (process.name:ln) or |
| 51 | + (process.name:busybox and process.args:ln) or |
| 52 | + (process.name:cp and process.args:"--symbolic-link") |
| 53 | +) and |
| 54 | +process.args:( |
| 55 | + /bin/* or /sbin/* or /usr/bin/* or /usr/sbin/* or /usr/local/bin/* or /usr/local/sbin/* or |
| 56 | + /lib/* or /lib64/* or /usr/lib/* or /usr/lib64/* or /usr/local/lib/* or /usr/local/lib64/* |
| 57 | +) and |
| 58 | +process.args:(/tmp/* or /var/tmp/* or /dev/shm/* or /root/* or /home/* or /*/.*) and |
| 59 | +not process.args:(/tmp/mkinitcpio* or /var/tmp/mkinitramfs* or /var/tmp/dracut*) |
| 60 | +''' |
| 61 | + |
| 62 | +[[rule.threat]] |
| 63 | +framework = "MITRE ATT&CK" |
| 64 | + |
| 65 | + [rule.threat.tactic] |
| 66 | + name = "Defense Evasion" |
| 67 | + id = "TA0005" |
| 68 | + reference = "https://attack.mitre.org/tactics/TA0005/" |
| 69 | + |
| 70 | + [[rule.threat.technique]] |
| 71 | + name = "Hijack Execution Flow" |
| 72 | + id = "T1574" |
| 73 | + reference = "https://attack.mitre.org/techniques/T1574/" |
| 74 | + |
| 75 | + [[rule.threat.technique]] |
| 76 | + name = "Indirect Command Execution" |
| 77 | + id = "T1202" |
| 78 | + reference = "https://attack.mitre.org/techniques/T1202/" |
| 79 | + |
| 80 | + [[rule.threat.technique]] |
| 81 | + name = "Hide Artifacts" |
| 82 | + id = "T1564" |
| 83 | + reference = "https://attack.mitre.org/techniques/T1564/" |
| 84 | + |
| 85 | +[rule.new_terms] |
| 86 | +field = "new_terms_fields" |
| 87 | +value = ["host.id", "process.parent.name"] |
| 88 | + |
| 89 | +[[rule.new_terms.history_window_start]] |
| 90 | +field = "history_window_start" |
| 91 | +value = "now-10d" |
0 commit comments