Skip to content

feat(analyzer): detect privileged container execution and escape primitives as PE5#214

Open
CharmingGroot wants to merge 1 commit into
NVIDIA:mainfrom
CharmingGroot:feat/pe5-container-escape
Open

feat(analyzer): detect privileged container execution and escape primitives as PE5#214
CharmingGroot wants to merge 1 commit into
NVIDIA:mainfrom
CharmingGroot:feat/pe5-container-escape

Conversation

@CharmingGroot

Copy link
Copy Markdown
Contributor

Summary

PE4 (#189) detects Docker socket access. This adds PE5, its CLI counterpart: privileged container execution and container-escape primitives that reach the same host takeover through docker run flags and kernel interfaces. Verified undetected on v2.3.5 in #213.

Changes

static_patterns_privilege_escalation.py gains PE5_PATTERNS (--privileged, host root mount -v /:, --cap-add=SYS_ADMIN, host namespaces --pid/net=host, --device, --security-opt …=unconfined, nsenter, cgroup release_agent, /proc/<pid>/ns/, unshare --map-root-user) and a best-confidence-per-line PE5 pass that mirrors PE4, with the documentation-example filter applied. PE5 findings are HIGH.

Testing

12 new tests cover each primitive (privileged, host root mount, cap-add, host namespaces, nsenter, release_agent, unshare), multi-flag dedup (one finding per line), a benign docker run negative, and a markdown documentation-example exclusion. make format and make lint pass; uv run pytest -m "not integration and not provider" reports 999 passed, 0 failed.

Closes #213

…itives as PE5

PE4 detects Docker socket access; PE5 is its CLI counterpart for privileged container execution and escape primitives (docker run --privileged / -v /:/ / --cap-add=SYS_ADMIN, host namespaces --pid/net=host, --device, --security-opt unconfined, nsenter, cgroup release_agent, /proc/<pid>/ns/, unshare --map-root-user) that reach the same host takeover. Mirrors PE4's best-confidence-per-line pass with the documentation-example filter.

Signed-off-by: CharmingGroot <ohyes9711@gmail.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving — strong additive PE5 (privileged container / container escape) detection: privileged flags, host-root mount, dangerous --cap-add, host namespaces, --device, unconfined, nsenter, the cgroup release_agent escape (CVE-2022-0492 class, 0.95), /proc/<pid>/ns/, and unshare. Per-line best-confidence dedup avoids double-reporting a multi-flag docker run, doc examples are filtered, and existing PE1–PE4 are untouched. Test coverage is excellent.

Non-blocking: --device[=\s]+/dev/ (0.7) will also flag legitimate hardware passthrough (e.g. /dev/nvidia0, /dev/snd); acceptable for a manual-review signal at that confidence, but worth keeping an eye on for FP noise.

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

Labels

None yet

Projects

None yet

2 participants