{"id":"CVE-2026-139129","aliases":["CVE-2026-139129"],"related":[],"kind":"vulnerability","state":"published","title":"xattr: always invoke cap_convert_nscap() for security.capability writes","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"}],"published":"2026-11-30T13:31:50.995Z","modified":"2026-11-30T14:18:27.113Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","fixed":"95d264a93340840b52d54ccf321dc7e4875d88b4","status":"affected"},{"type":"git","introduced":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","fixed":"a0d86d8e7297fb51b924642fe256b4a8d70ff7c7","status":"affected"},{"type":"git","introduced":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","fixed":"136fbb8cba5236655a4e0be62b96a8f3bb4f3568","status":"affected"},{"type":"git","introduced":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","fixed":"3a0260fc82412405c00491efe2287650bcbfb373","status":"affected"},{"type":"git","introduced":"8db6c34f1dbc8e06aa016a9b829b06902c3e1340","fixed":"0f4a9e682f7fa5becc3af7204606d9bf4780e425","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.14","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.14","status":"unaffected"},{"type":"semver","introduced":"6.6.163","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.119","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.65","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.3.6","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/95d264a93340840b52d54ccf321dc7e4875d88b4","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a0d86d8e7297fb51b924642fe256b4a8d70ff7c7","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/136fbb8cba5236655a4e0be62b96a8f3bb4f3568","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/3a0260fc82412405c00491efe2287650bcbfb373","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/0f4a9e682f7fa5becc3af7204606d9bf4780e425","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-139129","url":"https://www.cve.org/CVERecord?id=CVE-2026-139129","licence":"CVE Terms of Use","modified":"2026-11-30T13:31:50.995Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-139129","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139129","licence":"Public domain","modified":"2026-11-30T14:18:27.113Z"}],"updatedAt":"2026-11-30T14:32:56.380Z","epss":{"score":0.0037,"percentile":0.33009,"date":"2026-12-01T12:00:22.000Z"}}