Skip to content

feat(rules): detect container shell spawn for MITRE T1059#363

Open
JayKnowSo wants to merge 2 commits into
falcosecurity:mainfrom
JayKnowSo:feat/detect-container-escape-t1059
Open

feat(rules): detect container shell spawn for MITRE T1059#363
JayKnowSo wants to merge 2 commits into
falcosecurity:mainfrom
JayKnowSo:feat/detect-container-escape-t1059

Conversation

@JayKnowSo

Copy link
Copy Markdown

Adds detection rule for shell processes spawned inside containers by non-shell parent processes — a common indicator of container escape attempts and command injection exploitation.

MITRE ATT&CK: T1059 - Command and Scripting Interpreter
Tags: container, shell, mitre_execution

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind feature

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area rules

/area registry

/area build

/area documentation

Proposed rule maturity level

Uncomment one (or more) /area <> lines (only for PRs that add or modify rules):

/area maturity-stable

/area maturity-incubating

/area maturity-sandbox

/area maturity-deprecated

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

@poiana

poiana commented Apr 20, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JayKnowSo
Once this PR has been reviewed and has the lgtm label, please assign loresuso for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana

poiana commented Apr 20, 2026

Copy link
Copy Markdown

Welcome @JayKnowSo! It looks like this is your first PR to falcosecurity/rules 🎉

@poiana poiana added the size/S label Apr 20, 2026
@leogr

leogr commented May 19, 2026

Copy link
Copy Markdown
Member

Hey @JayKnowSo

Can you sign-off your commit, please? 🙏

@poiana poiana added size/M and removed size/S labels May 26, 2026
JayKnowSo added 2 commits May 25, 2026 21:46
Adds detection rule for shell processes spawned inside containers
by non-shell parent processes — a common indicator of container
escape attempts and command injection exploitation.

MITRE ATT&CK: T1059 - Command and Scripting Interpreter
Tags: container, shell, mitre_execution

Signed-off-by: Jemel Padilla <worklife0524@gmail.com>
- drop image= field from output (defer to append_output config)
- add exe_flags=%evt.arg.flags per spawned_process style guide
- anchor systemctl/service stop args with startswith and leading space
- anchor iptables -F flag with startswith and leading-space patterns
- drop network tag (rule fires on execve only, no socket activity)

Signed-off-by: Jemel Padilla <worklife0524@gmail.com>
@JayKnowSo JayKnowSo force-pushed the feat/detect-container-escape-t1059 branch from 407a871 to c5c64c5 Compare May 26, 2026 01:46
@JayKnowSo

Copy link
Copy Markdown
Author

All four addressed.
Cleaned the output fields — dropped image= and args=, added exe_flags per the spawned_process convention.
Anchored the stop args with startswith and put leading spaces on the daemon names. Caught the same pattern on the iptables -F flag — first position and mid-args both covered now.
Dropped network from the tags. Rule never touches a socket — shouldn't have been there.
Also squared away the DCO signoff on both commits — apologies for missing that.
Pushed. Thanks for the welcome and the patience.

@JayKnowSo

Copy link
Copy Markdown
Author

CI failures appear to be GitHub Actions infrastructure issues — internal server errors on action archive downloads and a 403 on the repo access. Not related to the rule changes. Happy to re-run once the CI stabilizes.

@JayKnowSo

Copy link
Copy Markdown
Author

No yamllint violations in the code added by this PR. The 53 errors in
falco_rules.yaml and 67 in falco-incubating_rules.yaml are pre-existing
and not introduced by these changes.

Happy to open a separate chore PR to fix the line-length violations across
the affected rule files if that would help unblock the merge pipeline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants