Skip to content

GHSA-4q85-33p6-j5g6

CVE Information

Impact

A logic error in libseccomp’s filter tree construction can cause generated seccomp-BPF filters to allow syscalls that should have been denied.

The issue affects policies on 64-bit architectures that add multiple rules for the same syscall and the same 64-bit argument using SCMP_CMP_LT or SCMP_CMP_LE, where the rules have the same high 32-bit comparison value, different low 32-bit values, and different actions. When libseccomp merges those rules, _db_tree_add() updates the wrong action field: the false-path action is left unchanged while the true-path action may be overwritten.

As a result, an application, container runtime, sandbox, or other seccomp user may believe a syscall argument range is blocked when the generated kernel filter actually permits part of that range. The practical impact depends on the sandbox policy and the syscalls being filtered, but this can weaken or bypass intended seccomp restrictions.

Affected versions include libseccomp releases containing commit c5bf78de480b and prior to the fix, including v2.4.0 through v2.6.0.

The following code snippet reproduces the bug:

rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(pwrite64), 1,
                      SCMP_A3_64(SCMP_CMP_LT, 0x100000005ULL));
rc = seccomp_rule_add(ctx, SCMP_ACT_ERRNO(99), SCMP_SYS(pwrite64), 1,
                       SCMP_A3_64(SCMP_CMP_LT, 0x100000002ULL));

If the order of the rules is switched, the bug is not reproduced:

rc = seccomp_rule_add(ctx, SCMP_ACT_ERRNO(99), SCMP_SYS(pwrite64), 1,
                      SCMP_A3_64(SCMP_CMP_LT, 0x100000002ULL));
rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(pwrite64), 1,
                      SCMP_A3_64(SCMP_CMP_LT, 0x100000005ULL));

Patches

The issue is fixed by correcting the copied field assignment in src/db.c so that the false-path action is updated:

x_iter->act_f = n_iter->act_f

Users should upgrade to libseccomp release v2.6.1 or greater, or apply the patch/backport containing the following commit:

commit 700b140cdd63a84ff20b4042534df911224af532
Author: Paul Moore <paul@paul-moore.com>
Date:   Mon Jun 22 16:24:07 2026 -0400

    db: fix a copy-n-paste typo in _db_tree_add()
    
    Fix a copy-n-paste error that could result in problems when adding a new
    rule to existing filter tree.  When adding a new rule, if any part of the
    new rule required updating the false action of an existing filter tree
    node, due to the typo, instead of updating the false action, the true
    action would be overwritten and the existing false action would remain
    unchanged.
    
    This patch corrects the typo and ensures that the correct actions are
    updated.
    
    Reported-by: Feng Xue w/XGPT (ThreatBook) <feng.xue@outlook.com>
    Reviewed-by: Tom Hromatka (Oracle) <tom.hromatka@gmail.com>
    Tested-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 5404f5c2a6bf5d6f13d391a9237d9018d56246a8)

Workarounds

Users who cannot upgrade immediately should review seccomp policies for overlapping SCMP_CMP_LT or SCMP_CMP_LE rules on the same 64-bit syscall argument with different actions. Avoid expressing allow/deny boundaries in that overlapping form until a fixed libseccomp is in use.

To mitigate this, affected policies can often be rewritten to avoid conflicting less-than / less-than-or-equal rules on the same 64-bit argument, for example by using non-overlapping ranges or alternative comparison forms. As outlined above, changing the order of when the rules are added may also be sufficient to work around the bug. The filter can be verified by examining the libseccomp PFC output.

Existing running processes or containers must reload their seccomp filters after libseccomp is patched; already-loaded kernel filters are not automatically regenerated.

References

  • Project: https://github.com/seccomp/libseccomp
  • Affected code: src/db.c, _db_tree_add()
  • Patch: https://github.com/seccomp/libseccomp/commit/700b140cdd63a84ff20b4042534df911224af532

Credits

Reported by Feng Xue w/XGPT (ThreatBook)