Skip to content

Commit 0a065c5

Browse files
sergio-correiagregkh
authored andcommitted
audit: fix incorrect inheritable capability in CAPSET records
commit e4a6404 upstream. __audit_log_capset() records the effective capability set into the inheritable field due to a copy-paste error. Every CAPSET audit record therefore reports cap_pi (process inheritable) with the value of cap_effective instead of cap_inheritable. This silently corrupts audit data used for compliance and forensic analysis: an attacker who modifies inheritable capabilities to prepare for a privilege-escalating exec would have the change masked in the audit trail. The bug has been present since the original introduction of CAPSET audit records in 2008. Cc: stable@vger.kernel.org Fixes: e68b75a ("When the capset syscall is used it is not possible for audit to record the actual capbilities being added/removed. This patch adds a new record type which emits the target pid and the eff, inh, and perm cap sets.") Reviewed-by: Ricardo Robaina <rrobaina@redhat.com> Assisted-by: Claude:claude-opus-4-6 Signed-off-by: Sergio Correia <scorreia@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8aff0b9 commit 0a065c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kernel/auditsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,7 @@ void __audit_log_capset(const struct cred *new, const struct cred *old)
28452845

28462846
context->capset.pid = task_tgid_nr(current);
28472847
context->capset.cap.effective = new->cap_effective;
2848-
context->capset.cap.inheritable = new->cap_effective;
2848+
context->capset.cap.inheritable = new->cap_inheritable;
28492849
context->capset.cap.permitted = new->cap_permitted;
28502850
context->capset.cap.ambient = new->cap_ambient;
28512851
context->type = AUDIT_CAPSET;

0 commit comments

Comments
 (0)