{"id":"CVE-2026-139129","summary":"xattr: always invoke cap_convert_nscap() for security.capability writes","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nxattr: always invoke cap_convert_nscap() for security.capability writes\n\nCommit 8db6c34f1dbc (\"Introduce v3 namespaced file capabilities\") changed\ncap_inode_setxattr() to return 0 unconditionally for XATTR_NAME_CAPS\n(\"security.capability\") and moved capability validation into\ncap_convert_nscap(), but placed the call inside the \"if (size)\" block in\nsetxattr(). Commit 7c03e2cda4a5 (\"vfs: move cap_convert_nscap() call into\nvfs_setxattr()\") preserved that \"size &&\" condition in vfs_setxattr():\n\n\tif (size && strcmp(name, XATTR_NAME_CAPS) == 0) {\n\t\terror = cap_convert_nscap(idmap, dentry, &value, size);\n\t\t...\n\t}\n\nFor security.* extended attributes, xattr_permission() skips\ninode_permission(MAY_WRITE) and leaves permission checks to the security\nmodule, while cap_inode_setxattr() returns 0 for XATTR_NAME_CAPS assuming\ncap_convert_nscap() has already validated the write. Because\n__vfs_setxattr() treats size == 0 as an empty attribute write (setting\nvalue = \"\") rather than a removal, calling setxattr(2) on\n\"security.capability\" with size == 0 bypasses cap_convert_nscap() and\nallows an unprivileged caller without CAP_SETFCAP or write permission on\nthe target inode to write a 0-byte security.capability xattr (or\noverwrite an existing one).\n\nWhen that binary is subsequently executed, get_vfs_caps_from_disk() reads\nthe 0-byte security.capability xattr and fails the\nsize \u003c sizeof(magic_etc) check with -EINVAL, causing execve(2) to fail\nwith -EINVAL.\n\nAlways invoke cap_convert_nscap() when strcmp(name, XATTR_NAME_CAPS) == 0\nregardless of size, so that 0-byte writes hit the existing !*ivalue /\n!validheader() checks in cap_convert_nscap() and are rejected with\n-EINVAL.","modified":"2026-11-30T15:02:25.550895613Z","published":"2026-11-30T13:31:50.995Z","database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139129.json","cna_assigner":"Linux"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/0f4a9e682f7fa5becc3af7204606d9bf4780e425"},{"type":"WEB","url":"https://git.kernel.org/stable/c/136fbb8cba5236655a4e0be62b96a8f3bb4f3568"},{"type":"WEB","url":"https://git.kernel.org/stable/c/3a0260fc82412405c00491efe2287650bcbfb373"},{"type":"WEB","url":"https://git.kernel.org/stable/c/95d264a93340840b52d54ccf321dc7e4875d88b4"},{"type":"WEB","url":"https://git.kernel.org/stable/c/a0d86d8e7297fb51b924642fe256b4a8d70ff7c7"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/139xxx/CVE-2026-139129.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139129"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340"},{"fixed":"95d264a93340840b52d54ccf321dc7e4875d88b4"},{"fixed":"a0d86d8e7297fb51b924642fe256b4a8d70ff7c7"},{"fixed":"136fbb8cba5236655a4e0be62b96a8f3bb4f3568"},{"fixed":"3a0260fc82412405c00491efe2287650bcbfb373"},{"fixed":"0f4a9e682f7fa5becc3af7204606d9bf4780e425"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139129.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.14.0"},{"fixed":"6.6.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.12.119"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.65"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-139129.json"}}],"schema_version":"1.9.2"}