Skip to content
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

new(rules): Decoding Payload in Container #161

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions rules/falco-sandbox_rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1712,3 +1712,26 @@
output: BPF Program Not Profiled (bpf_cmd=%evt.arg.cmd 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 %container.info)
priority: NOTICE
tags: [maturity_sandbox, host, container, mitre_persistence, TA0003]

- list: known_decode_payload_containers
items: []

- macro: base64_decoding
condition: (proc.cmdline contains "base64" and (proc.cmdline contains "--decode" or proc.cmdline contains "-d"))

- rule: Decoding Payload in Container
desc: >
Detect any use of {base64} decoding in a container. Legitimate applications may decode encoded payloads. The template list
known_decode_payload_containers can be used for simple tuning and customization, or you can adopt custom, more refined tuning. Less
sophisticated adversaries may {base64}-decode their payloads not only to obfuscate them, but also to ensure that the payload remains
intact when the application processes it. Note that injecting commands into an application's input often results in the application
processing passed strings like "sh -c". In these cases, you may be lucky and the encoded blob will also be logged. Otherwise, all you
will see is the {base64} decoding command, as the encoded blob was already interpreted by the shell.
condition: >
spawned_process
and container
and base64_decoding
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, rule is composed in a way that we can add more types of decoding as we see fit, for now only base64 decoding.

and not container.image.repository in (known_decode_payload_containers)
output: Decoding Payload 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 %container.info)
priority: INFO
tags: [maturity_sandbox, container, process, mitre_command_and_control, T1132]
Loading