GHSA-46fr-jh49-xvhx
CVE Information
Impact
libseccomp is vulnerable to heap corruption during BPF filter generation when an application builds an extremely large seccomp rule set, roughly 66,000 rules. The BPF instruction count can overflow, causing
_bpf_append_blk()to enter an error path that frees the program buffer while leaving a dangling pointer. Later cleanup can free the same pointer again.An attacker who can supply or influence a very large seccomp profile, for example through a container runtime or other service that compiles untrusted seccomp filters, may be able to crash the process building the filter. The corruption occurs during filter generation, before the filter is loaded into the kernel. Typical seccomp profiles are much smaller, so exploitation requires an unusually large, non-default rule set.
Affected versions include all libseccomp releases up to and including v2.6.0. This is fixed in v2.6.1 and newer
Patches
The issue has been patched by clearing the BPF program buffer pointer after it is freed in the
_bpf_append_blk()failure path, preventing the later double-free.Users should upgrade to libseccomp release v2.6.1 or greater, or apply the patch/backport containing the following commit:
commit 2d9db17cc0daa7f0d6b826091bb15d519ac512cc Author: Paul Moore <paul@paul-moore.com> Date: Tue Jun 23 15:29:37 2026 -0400 bpf: properly reset/clear the bpf_program on error in _bpf_append_blk() Ensure that the BPF program buffer pointer is (re)set to NULL after freeing. We also update the comment block to indicate that the program passed as a parameter is not free'd, but rather reset to an empty program. Reported-by: Feng Xue w/XGPT (ThreatBook) <feng.xue@outlook.com> Reviewed-by: Tom Hromatka (Oracle) <tom.hromatka@gmail.com> Tested-by: Feng Xue w/XGPT (ThreatBook) <feng.xue@outlook.com> Signed-off-by: Paul Moore <paul@paul-moore.com> (imported from commit 4f1d6ec8c340fa2d5bf4fca22050904a2284762b)Workarounds
Users who cannot upgrade should avoid compiling untrusted or attacker-controlled seccomp profiles. As a practical mitigation, reject or cap unusually large profiles before passing them to libseccomp, especially profiles with tens of thousands of rules or enough rules to generate more than 65,535 BPF instructions.
References
- Project: https://github.com/seccomp/libseccomp
- Affected code:
src/gen_bpf.c,_bpf_append_blk()- Patch: https://github.com/seccomp/libseccomp/commit/2d9db17cc0daa7f0d6b826091bb15d519ac512cc
Credits
Reported by Feng Xue w/XGPT (ThreatBook)