R0040: pod-spec exec fallback matches full argv vector#53
Conversation
Signed-off-by: entlein <einentlein@gmail.com>
resolveExecPath and getExecPathWithExePath both gained an "if argv[0] is absolute, trust argv[0] over exepath" tier in fd9e262. The justification (busybox-image symlink fidelity — record /bin/sh instead of /bin/busybox) does not survive the argv[0] spoofing case: `exec -a /bin/sh sleep 2` yields cmdline=/bin/sh while /proc/<pid>/exe stays /usr/bin/sleep, so the recorded identity is whatever an attacker chose, not what actually ran. ap.was_executed lookups for allowed paths then pass for arbitrary binaries. Reverts both functions to the v0.3.113 precedence: 1. exepath (kernel-authoritative) 2. argv[0] non-empty when exepath empty (fexecve / AT_EMPTY_PATH) 3. comm Busybox-image profiles record /bin/busybox (kernel-resolved) — the v0.3.113 behaviour. The symlink-faithful tier never shipped in a tagged release; only profiles built against fd9e262 depended on it, all internal. Adds explicit absolute-argv[0]-spoof regression tests on both sides (resolveExecPath and getExecPathWithExePath) pinning that `args=["/bin/sh", …], exepath="/usr/bin/sleep"` resolves to `/usr/bin/sleep`. Updated the busybox tests on both sides to reflect the kernel-authoritative semantics. Addresses matthyx review on event_reporting.go:63 (2026-05-27). Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Prevents Go MVS from picking up a higher storage version pulled in transitively by other deps. PR kubescape#805 (parse.get_exec_path 3-arg overload, event_reporting spoof revert, CEL auto-rewrite shim) does not reference any post-v0.0.258 storage symbol, so v0.0.258 is the floor — and now also the ceiling. Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
…just maybe Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: entlein <einentlein@gmail.com>
…rage , lets do a benchmark and get this green before pivoting abck to storage Signed-off-by: entlein <einentlein@gmail.com>
…x, good thing this ll be squashed Signed-off-by: entlein <einentlein@gmail.com>
…se the cel rule will be slow Signed-off-by: entlein <einentlein@gmail.com>
…ow various wildcards Signed-off-by: entlein <einentlein@gmail.com>
was_executed_with_args fell back to a path-only pod-spec check, so an exec of a pod-spec-declared binary with unexpected arguments was treated as allowed and R0040 stayed silent. Compare the full runtime argv against a declared command vector (Command++Args, or a lifecycle hook Exec.Command) across main / init / ephemeral containers instead. Tests: - unit (exec_podspec_test.go): full-vector match, command+args split, image-entrypoint no-match, PreStop/PostStart hooks, init + ephemeral. - component (Test_32): podspec_declared_command_matches_silent and podspec_command_arg_mismatch_fires_R0040.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Regression-tested this branch through the fork's real CI (CT run 26974475205): 21/21 GREEN. Heads-up on the branch itself: Coherence (all anchored on the same content):
Verified from per-job API conclusions (21× Test_02 ( |
7c4f269 to
40647b0
Compare
Fork CI test branch for the pod-spec fallback fix.
was_executed_with_args fell back to a path-only pod-spec check, so an exec of a pod-spec-declared binary with unexpected arguments was treated as allowed and R0040 stayed silent. This compares the full runtime argv against the declared command vector (Command++Args, or a lifecycle hook Exec.Command) across main / init / ephemeral containers.
Coverage: