{"id":"CVE-2025-40203","state":"PUBLISHED","title":"listmount: don't call path_put() under namespace semaphore","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nlistmount: don't call path_put() under namespace semaphore\n\nMassage listmount() and make sure we don't call path_put() under the\nnamespace semaphore. If we put the last reference we're fscked.","publishedAt":"2025-11-12T21:56:34.801Z","updatedAt":"2026-08-05T12:08:32.046Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/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":"b4c2bea8ceaa50cd42a8f73667389d801a3ecf2d","status":"affected","lessThan":"659874b7ee4976ad9ce476e07fd36bc67b3537f1","versionType":"git"},{"version":"b4c2bea8ceaa50cd42a8f73667389d801a3ecf2d","status":"affected","lessThan":"9c80da26fda2fdcaac7f92b5908875b3108830ff","versionType":"git"},{"version":"b4c2bea8ceaa50cd42a8f73667389d801a3ecf2d","status":"affected","lessThan":"c1f86d0ac322c7e77f6f8dbd216c65d39358ffc0","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/namespace.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.12.54","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.4","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/namespace.c"]}],"references":["https://git.kernel.org/stable/c/659874b7ee4976ad9ce476e07fd36bc67b3537f1","https://git.kernel.org/stable/c/9c80da26fda2fdcaac7f92b5908875b3108830ff","https://git.kernel.org/stable/c/c1f86d0ac322c7e77f6f8dbd216c65d39358ffc0"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/40xxx/CVE-2025-40203.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40203","state":"PUBLISHED","datePublished":"2025-11-12T21:56:34.801Z","dateUpdated":"2026-08-05T12:08:32.046Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.179Z"},"containers":{"cna":{"title":"listmount: don't call path_put() under namespace semaphore","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nlistmount: don't call path_put() under namespace semaphore\n\nMassage listmount() and make sure we don't call path_put() under the\nnamespace semaphore. If we put the last reference we're fscked."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"b4c2bea8ceaa50cd42a8f73667389d801a3ecf2d","status":"affected","lessThan":"659874b7ee4976ad9ce476e07fd36bc67b3537f1","versionType":"git"},{"version":"b4c2bea8ceaa50cd42a8f73667389d801a3ecf2d","status":"affected","lessThan":"9c80da26fda2fdcaac7f92b5908875b3108830ff","versionType":"git"},{"version":"b4c2bea8ceaa50cd42a8f73667389d801a3ecf2d","status":"affected","lessThan":"c1f86d0ac322c7e77f6f8dbd216c65d39358ffc0","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/namespace.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.12.54","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.4","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/namespace.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/659874b7ee4976ad9ce476e07fd36bc67b3537f1"},{"url":"https://git.kernel.org/stable/c/9c80da26fda2fdcaac7f92b5908875b3108830ff"},{"url":"https://git.kernel.org/stable/c/c1f86d0ac322c7e77f6f8dbd216c65d39358ffc0"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerability is reached only through the `listmount(2)` system call in fs/namespace.c; there is no remote or adjacent-network path to `do_listmount()`. Exploitation requires the ability to execute syscalls on the target, i.e. local access.\nAC:L - The attacker controls both sides of the race — it holds the extra path reference via `listmount()` while a `CLONE_FS` sibling thread moves `fs->root` off a lazily-unmounted mount, deterministically making the in-syscall `path_put()` the final reference. The setup (unshare, tmpfs mount, chroot, `umount2(MNT_DETACH)`) is scripted and retryable without limit.\nPR:L - `listmount(2)` requires no capability at all for the caller's own mount namespace, and the mount/chroot/lazy-umount setup is obtainable by any unprivileged user via `unshare -Ur` since CAP_SYS_ADMIN/CAP_SYS_CHROOT are granted inside a user namespace. No real root in the init namespace is needed.\nUI:N - The attacking process performs every step itself — namespace creation, mount setup, and the concurrent `listmount()`/`chroot()` race. No victim action or cooperation is involved.\nS:U - The corrupted state (`struct mount`, `struct mountpoint`, `struct dentry`, `namespace_sem`) and the resulting impact all live within the kernel's own security authority. No hypervisor, IOMMU, or sandbox boundary is crossed.\nC:H - The final `mntput_no_expire()` tears down mounts, frees `struct mountpoint`, and destroys dentries/inodes while only the read side of `namespace_sem` is held, so concurrent readers (other `listmount()`/`statmount()`/propagation walkers that legitimately hold the read lock and expect a stable topology) can traverse freed objects — a use-after-free giving an attacker-influenceable kernel-memory read primitive via slab reuse.\nI:H - The same violated invariant permits mount-tree list surgery (`list_del(&mnt->mnt_instance)`, `unhash_mnt()`, child reparenting) to race concurrent read-side traversal, yielding linked-list corruption and use-after-free writes into reallocated slab objects, which is exploitable for control-flow hijacking.\nA:H - Performing the final `path_put()` under `namespace_sem` can block or self-deadlock — inode eviction can stall indefinitely on a userspace filesystem daemon, and `__detach_mounts()`'s `down_write(&namespace_sem)` on an already read-held semaphore deadlocks — hanging every mount, umount, statmount, and listmount on the system; the same UAF also reliably oopses the kernel."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:08:32.046Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.12.54"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.17.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}