-
Notifications
You must be signed in to change notification settings - Fork 93
new(rules): detect security tool impairment in containers (T1562.001) #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1007,6 +1007,36 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # when more than one event type is involved because some event will populate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # the filtercheck and others will always return <NA>. It would be better to use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # a more generic filter like `fs.path.*` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - macro: user_known_security_tool_disable_activities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| condition: (never_true) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - rule: Defense Tool Disabled or Modified in Container | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| desc: > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Detect attempts to disable or modify security tooling inside a running container, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| including flushing firewall rules via iptables or stopping security daemons such | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| as falco, auditd, or sysdig. Adversaries impair defenses after achieving initial | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| execution to operate undetected before lateral movement. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Maps to MITRE ATT&CK T1562.001 (Impair Defenses: Disable or Modify Tools). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| condition: > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| spawned_process and container | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (proc.name in (iptables, ip6tables) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (proc.args contains "-F" or proc.args contains "--flush" or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| proc.args contains "-X" or proc.args contains "--delete-chain")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1023
to
+1025
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Same precision concern as the
Comment on lines
+1023
to
+1025
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I have dug a bit more into this since my previous round, and it is worse than I described back then.
So, as written, the rule fires on routine CNI and kube-proxy activity in pretty much any Kubernetes cluster. The suggestion anchors the short flags on a whitespace boundary ( |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (proc.name = systemctl and proc.args contains "stop" and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (proc.args contains "falco" or proc.args contains "auditd" or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| proc.args contains "sysdig" or proc.args contains "osquery")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (proc.name = service and proc.args contains "stop" and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (proc.args contains "falco" or proc.args contains "auditd")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1027
to
+1032
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The current
Our convention for short-token matching is whitespace anchoring, see the netcat rule at falco_rules.yaml:849-851 (
Comment on lines
+1027
to
+1032
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Same anchoring concern as above, milder here since both substrings have to match.
For Btw, |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| and not user_known_security_tool_disable_activities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output: Security tool disabled or firewall rules cleared in container | evt_type=%evt.type user=%user.name user_uid=%user.uid user_loginuid=%user.loginuid process=%proc.name proc_exepath=%proc.exepath parent=%proc.pname command=%proc.cmdline terminal=%proc.tty exe_flags=%evt.arg.flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| priority: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WARNING | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1036
to
+1037
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Nit. 27 of the 31 existing rules in this file keep |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tags: [maturity_incubating, container, process, mitre_defense_evasion, T1562.001] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - rule: Delete or rename shell history | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| desc: > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Detect shell history deletion, frequently used by unsophisticated adversaries to eliminate evidence. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May you move the new macro and rule below the
Delete or rename shell historyrule?The
# todo!:block right above belongs to that rule - it is about avoidingevt.arg*in the output when a rule spans more than one event type. Inserting here re-parents the comment to your macro, which is quite confusing, since your rule isspawned_process-only andexe_flags=%evt.arg.flagsis exactly the right thing to have there.