CVE-2026-139129: xattr: always invoke cap_convert_nscap() for security.capability writes
In the Linux kernel, the following vulnerability has been resolved:
xattr: always invoke capconvertnscap() for security.capability writes
Commit 8db6c34f1dbc ("Introduce v3 namespaced file capabilities") changed capinodesetxattr() to return 0 unconditionally for XATTRNAMECAPS ("security.capability") and moved capability validation into capconvertnscap(), but placed the call inside the "if (size)" block in setxattr(). Commit 7c03e2cda4a5 ("vfs: move capconvertnscap() call into vfssetxattr()") preserved that "size &&" condition in vfssetxattr():
if (size && strcmp(name, XATTRNAMECAPS) == 0) { error = capconvertnscap(idmap, dentry, &value, size); ... }
For security. extended attributes, xattrpermission() skips inodepermission(MAYWRITE) and leaves permission checks to the security module, while capinodesetxattr() returns 0 for XATTRNAMECAPS assuming capconvertnscap() has already validated the write. Because vfssetxattr() treats size == 0 as an empty attribute write (setting value = "") rather than a removal, calling setxattr(2) on "security.capability" with size == 0 bypasses capconvertnscap() and allows an unprivileged caller without CAPSETFCAP or write permission on the target inode to write a 0-byte security.capability xattr (or overwrite an existing one).
When that binary is subsequently executed, getvfscapsfromdisk() reads the 0-byte security.capability xattr and fails the size < sizeof(magicetc) check with -EINVAL, causing execve(2) to fail with -EINVAL.
Always invoke capconvertnscap() when strcmp(name, XATTRNAMECAPS) == 0 regardless of size, so that 0-byte writes hit the existing !ivalue / !validheader() checks in capconvertnscap() and are rejected with -EINVAL.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.119 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.65 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.6-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch xattr: always invoke cap_convert_nscap() for security.capability writes
Event History
Frequently Asked Questions
What does an attacker need to trigger the issue?
A local unprivileged caller must invoke setxattr(2) on the security.capability extended attribute with a size of zero. The flawed path can bypass cap_convert_nscap() validation, including the expected CAP_SETFCAP check.
Is this triggered by removing the capability attribute?
No. In this path, a zero-size security.capability write is treated as setting an empty attribute value rather than removing the attribute. That distinction is what allows the validation call to be skipped.
Why do normal extended-attribute permission checks not prevent this?
For security.* attributes, xattr_permission() skips inode_permission(MAY_WRITE) and defers checks to the security module. For security.capability, cap_inode_setxattr() returns success on the assumption that cap_convert_nscap() has already validated the write.