{"id":"CVE-2026-99476","state":"PUBLISHED","title":"fsverity: Set S_VERITY only after rollback is no longer possible","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nfsverity: Set S_VERITY only after rollback is no longer possible\n\nCommit f77f281b6118 (\"fsverity: use a hashtable to find the\nfsverity_info\") changed the implementation of FS_IOC_ENABLE_VERITY to\nmake concurrent reads start going through fsverity verification slightly\nearlier than they did before.\n\nInstead of it happening when enable_verity() calls fsverity_set_info(),\nit now happens when ->end_enable_verity() sets S_VERITY.\n\nHowever, ext4 and btrfs can roll back verity after they set S_VERITY,\ncausing a use-after-free.\n\nFix that by making ext4 and btrfs set S_VERITY only after rollback is no\nlonger possible.  On failure, don't roll back S_VERITY, but do roll back\nthe filesystem-specific verity flag.\n\nAlso update enable_verity() to handle any future instances of this bug\nmore safely by warning and *not* freeing the fsverity_info.\n\nFinally, tweak some comments.  Clarify one, and move information from\nanother to its proper place in the comment for ->end_enable_verity().","publishedAt":"2026-11-19T14:43:08.574Z","updatedAt":"2026-11-22T11:08:32.361Z","severity":{"score":7,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f77f281b61183a5c0b87e6a4d101c70bd32c1c79","status":"affected","lessThan":"10c13801ea38e4ced23c59052ce45acb07c5deda","versionType":"git"},{"version":"f77f281b61183a5c0b87e6a4d101c70bd32c1c79","status":"affected","lessThan":"c349b233d6ab0fc3517401a1e2d36f5f90eb8c9b","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/verity.c","fs/ext4/verity.c","fs/verity/enable.c","include/linux/fsverity.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"7.0","status":"affected"},{"version":"0","status":"unaffected","lessThan":"7.0","versionType":"semver"},{"version":"7.3.2","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/btrfs/verity.c","fs/ext4/verity.c","fs/verity/enable.c","include/linux/fsverity.h"]}],"references":["https://git.kernel.org/stable/c/10c13801ea38e4ced23c59052ce45acb07c5deda","https://git.kernel.org/stable/c/c349b233d6ab0fc3517401a1e2d36f5f90eb8c9b"],"weaknesses":[],"ingestedAt":"2026-11-22T11:18:06.032Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/99xxx/CVE-2026-99476.json","commit":"247cc9beefd85903834df0592e88a44f4d599223","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99476","state":"PUBLISHED","datePublished":"2026-11-19T14:43:08.574Z","dateUpdated":"2026-11-22T11:08:32.361Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.417Z"},"containers":{"cna":{"title":"fsverity: Set S_VERITY only after rollback is no longer possible","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nfsverity: Set S_VERITY only after rollback is no longer possible\n\nCommit f77f281b6118 (\"fsverity: use a hashtable to find the\nfsverity_info\") changed the implementation of FS_IOC_ENABLE_VERITY to\nmake concurrent reads start going through fsverity verification slightly\nearlier than they did before.\n\nInstead of it happening when enable_verity() calls fsverity_set_info(),\nit now happens when ->end_enable_verity() sets S_VERITY.\n\nHowever, ext4 and btrfs can roll back verity after they set S_VERITY,\ncausing a use-after-free.\n\nFix that by making ext4 and btrfs set S_VERITY only after rollback is no\nlonger possible.  On failure, don't roll back S_VERITY, but do roll back\nthe filesystem-specific verity flag.\n\nAlso update enable_verity() to handle any future instances of this bug\nmore safely by warning and *not* freeing the fsverity_info.\n\nFinally, tweak some comments.  Clarify one, and move information from\nanother to its proper place in the comment for ->end_enable_verity()."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"f77f281b61183a5c0b87e6a4d101c70bd32c1c79","status":"affected","lessThan":"10c13801ea38e4ced23c59052ce45acb07c5deda","versionType":"git"},{"version":"f77f281b61183a5c0b87e6a4d101c70bd32c1c79","status":"affected","lessThan":"c349b233d6ab0fc3517401a1e2d36f5f90eb8c9b","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/verity.c","fs/ext4/verity.c","fs/verity/enable.c","include/linux/fsverity.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"7.0","status":"affected"},{"version":"0","status":"unaffected","lessThan":"7.0","versionType":"semver"},{"version":"7.3.2","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/btrfs/verity.c","fs/ext4/verity.c","fs/verity/enable.c","include/linux/fsverity.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/10c13801ea38e4ced23c59052ce45acb07c5deda"},{"url":"https://git.kernel.org/stable/c/c349b233d6ab0fc3517401a1e2d36f5f90eb8c9b"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - FS_IOC_ENABLE_VERITY reaches this through ext4_ioctl or btrfs_ioctl into fsverity_ioctl_enable and enable_verity. The failing step is ext4_end_enable_verity or btrfs_end_enable_verity; the caller supplies struct fsverity_enable_arg locally, and no remote protocol message carries the state that sets S_VERITY.\nAC:H - enable_verity calls fsverity_remove_info only if ext4_end_enable_verity or btrfs_end_enable_verity fails. ext4 publishes S_VERITY via ext4_set_inode_flags immediately before ext4_mark_iloc_dirty, which fails on ext4_emergency_state or an aborted journal. btrfs publishes it in finish_verity only after btrfs_start_transaction has reserved metadata, and a fatal signal returns from build_merkle_tree before either flag is set.\nPR:L - fsverity_ioctl_enable gates on file_permission(filp, MAY_WRITE), FMODE_READ, and mnt_want_write_file. Neither ext4_ioctl nor btrfs_ioctl adds a capability check for FS_IOC_ENABLE_VERITY; the ext4 verity incompat feature is a superblock flag, not a credential.\nUI:N - The caller opens its own regular file O_RDONLY, issues the ioctl, and can race a read through generic_file_read_iter or btrfs_file_read_iter, neither of which takes i_rwsem. No second user has to mount media or open the file.\nS:U - The freed object is the inode's fsverity_info in the same kernel that handled the ioctl. Exploitation is host kernel memory corruption, not a guest-to-host or IOMMU boundary crossing.\nC:H - fsverity_remove_info drops the object and fsverity_free_info kfree's tree_params.hashstate and kvfree's hash_block_verified. ext4 verity_work and btrfs end_bbio_data_read still pass that fsverity_info to fsverity_verify_bio or fsverity_verify_blocks, which read those reclaimed fields.\nI:H - is_hash_block_verified clear_bit()s vi->hash_block_verified, and fsverity_hash_block follows vi->tree_params.hash_alg, after both allocations have been freed on the failed enable path. A concurrent reader can therefore write into reclaimed memory and treat a sprayed hash_alg pointer as the algorithm descriptor.\nA:H - ext4 queues the dangling fsverity_info to verity_work, which calls fsverity_verify_bio, and btrfs end_folio_read calls fsverity_verify_folio. Dereferencing a freed hash_alg or hashstate oopses, and fsverity_hash_block hits BUG() if a reused object has an unexpected algo_id."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-22T11:08:32.361Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"7.0","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"7.0","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}