{"id":"CVE-2026-139129","state":"PUBLISHED","title":"xattr: always invoke cap_convert_nscap() for security.capability writes","description":"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 < 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.","publishedAt":"2026-11-30T13:31:50.995Z","updatedAt":"2026-11-30T13:31:50.995Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"95d264a93340840b52d54ccf321dc7e4875d88b4","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"a0d86d8e7297fb51b924642fe256b4a8d70ff7c7","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"136fbb8cba5236655a4e0be62b96a8f3bb4f3568","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"3a0260fc82412405c00491efe2287650bcbfb373","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"0f4a9e682f7fa5becc3af7204606d9bf4780e425","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/xattr.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.14","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.14","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/xattr.c"]}],"references":["https://git.kernel.org/stable/c/95d264a93340840b52d54ccf321dc7e4875d88b4","https://git.kernel.org/stable/c/a0d86d8e7297fb51b924642fe256b4a8d70ff7c7","https://git.kernel.org/stable/c/136fbb8cba5236655a4e0be62b96a8f3bb4f3568","https://git.kernel.org/stable/c/3a0260fc82412405c00491efe2287650bcbfb373","https://git.kernel.org/stable/c/0f4a9e682f7fa5becc3af7204606d9bf4780e425"],"weaknesses":[],"ingestedAt":"2026-11-30T13:42:04.437Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139129.json","commit":"5317bbbde1916a58cb1fadabb726eb126daf44c1","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139129","state":"PUBLISHED","datePublished":"2026-11-30T13:31:50.995Z","dateUpdated":"2026-11-30T13:31:50.995Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.915Z"},"containers":{"cna":{"title":"xattr: always invoke cap_convert_nscap() for security.capability writes","descriptions":[{"lang":"en","value":"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 < 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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"95d264a93340840b52d54ccf321dc7e4875d88b4","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"a0d86d8e7297fb51b924642fe256b4a8d70ff7c7","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"136fbb8cba5236655a4e0be62b96a8f3bb4f3568","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"3a0260fc82412405c00491efe2287650bcbfb373","versionType":"git"},{"version":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","status":"affected","lessThan":"0f4a9e682f7fa5becc3af7204606d9bf4780e425","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/xattr.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.14","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.14","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/xattr.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/95d264a93340840b52d54ccf321dc7e4875d88b4"},{"url":"https://git.kernel.org/stable/c/a0d86d8e7297fb51b924642fe256b4a8d70ff7c7"},{"url":"https://git.kernel.org/stable/c/136fbb8cba5236655a4e0be62b96a8f3bb4f3568"},{"url":"https://git.kernel.org/stable/c/3a0260fc82412405c00491efe2287650bcbfb373"},{"url":"https://git.kernel.org/stable/c/0f4a9e682f7fa5becc3af7204606d9bf4780e425"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:31:50.995Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.14","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.14","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.14","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.14","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.14","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}