{ "dataType": "CVE_RECORD", "dataVersion": "5.2", "cveMetadata": { "cveId": "CVE-2025-37988", "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "state": "PUBLISHED", "assignerShortName": "Linux", "dateReserved": "2025-04-16T04:51:23.976Z", "datePublished": "2025-05-20T17:09:20.765Z", "dateUpdated": "2026-08-05T11:58:47.074Z" }, "containers": { "cna": { "providerMetadata": { "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux", "dateUpdated": "2026-08-05T11:58:47.074Z" }, "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nfix a couple of races in MNT_TREE_BENEATH handling by do_move_mount()\n\nNormally do_lock_mount(path, _) is locking a mountpoint pinned by\n*path and at the time when matching unlock_mount() unlocks that\nlocation it is still pinned by the same thing.\n\nUnfortunately, for 'beneath' case it's no longer that simple -\nthe object being locked is not the one *path points to. It's the\nmountpoint of path->mnt. The thing is, without sufficient locking\n->mnt_parent may change under us and none of the locks are held\nat that point. The rules are\n\t* mount_lock stabilizes m->mnt_parent for any mount m.\n\t* namespace_sem stabilizes m->mnt_parent, provided that\nm is mounted.\n\t* if either of the above holds and refcount of m is positive,\nwe are guaranteed the same for refcount of m->mnt_parent.\n\nnamespace_sem nests inside inode_lock(), so do_lock_mount() has\nto take inode_lock() before grabbing namespace_sem. It does\nrecheck that path->mnt is still mounted in the same place after\ngetting namespace_sem, and it does take care to pin the dentry.\nIt is needed, since otherwise we might end up with racing mount --move\n(or umount) happening while we were getting locks; in that case\ndentry would no longer be a mountpoint and could've been evicted\non memory pressure along with its inode - not something you want\nwhen grabbing lock on that inode.\n\nHowever, pinning a dentry is not enough - the matching mount is\nalso pinned only by the fact that path->mnt is mounted on top it\nand at that point we are not holding any locks whatsoever, so\nthe same kind of races could end up with all references to\nthat mount gone just as we are about to enter inode_lock().\nIf that happens, we are left with filesystem being shut down while\nwe are holding a dentry reference on it; results are not pretty.\n\nWhat we need to do is grab both dentry and mount at the same time;\nthat makes inode_lock() safe *and* avoids the problem with fs getting\nshut down under us. After taking namespace_sem we verify that\npath->mnt is still mounted (which stabilizes its ->mnt_parent) and\ncheck that it's still mounted at the same place. From that point\non to the matching namespace_unlock() we are guaranteed that\nmount/dentry pair we'd grabbed are also pinned by being the mountpoint\nof path->mnt, so we can quietly drop both the dentry reference (as\nthe current code does) and mnt one - it's OK to do under namespace_sem,\nsince we are not dropping the final refs.\n\nThat solves the problem on do_lock_mount() side; unlock_mount()\nalso has one, since dentry is guaranteed to stay pinned only until\nthe namespace_unlock(). That's easy to fix - just have inode_unlock()\ndone earlier, while it's still pinned by mp->m_dentry." } ], "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 exclusively through the local `move_mount(2)` syscall with `MOVE_MOUNT_BENEATH`, raced against local `umount(2)`/`mount --move`. No network or remote input is involved.\nAC:L - The attacker controls both sides of the race with their own threads in their own mount namespace and can retry unboundedly; the window between `read_sequnlock_excl(&mount_lock)` and `inode_lock()` can be widened deliberately by holding the target inode's `i_rwsem` so the victim thread blocks while the filesystem is torn down.\nPR:L - `may_mount()` only requires `CAP_SYS_ADMIN` against the mount namespace's user namespace, which an ordinary unprivileged user obtains via `unshare -Urm`; all subsequent setup (stacked tmpfs mounts, fsmount fd) is unprivileged inside that namespace.\nUI:N - The attacker performs every step — creating the namespace, the stacked mounts, and both racing syscalls — with no action by any other user or victim process.\nS:U - The corruption occurs within the kernel and yields local privilege escalation; it does not cross a hypervisor, IOMMU, or other separate security-authority boundary.\nC:H - The superblock/inode/dentry are freed while still referenced, so the attacker can reallocate the freed slab objects and read back kernel data through subsequent dentry/inode dereferences, enabling arbitrary kernel memory disclosure.\nI:H - `inode_lock()`/`inode_unlock()` perform rwsem writes into freed memory and the later `dput()`/`iput()` follow a dangling `sb->s_op` function-pointer table, giving a heap-spray-controlled write and control-flow hijack primitive for full privilege escalation.\nA:H - Losing the race reliably produces a use-after-free on a shut-down superblock (\"Dentry still in use\" / dangling `s_op` call), causing an oops or panic that can be triggered repeatedly by an unprivileged user." } ] } ], "affected": [ { "product": "Linux", "vendor": "Linux", "defaultStatus": "unaffected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "fs/namespace.c" ], "versions": [ { "version": "6ac392815628f317fcfdca1a39df00b9cc4ebc8b", "lessThan": "4f435c1f4c48ff84968e2d9159f6fa41f46cf998", "status": "affected", "versionType": "git" }, { "version": "6ac392815628f317fcfdca1a39df00b9cc4ebc8b", "lessThan": "a61afd54826ac24c2c93845c4f441dbc344875b1", "status": "affected", "versionType": "git" }, { "version": "6ac392815628f317fcfdca1a39df00b9cc4ebc8b", "lessThan": "d4b21e8cd3d7efa2deb9cff534f0133e84f35086", "status": "affected", "versionType": "git" }, { "version": "6ac392815628f317fcfdca1a39df00b9cc4ebc8b", "lessThan": "0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6", "status": "affected", "versionType": "git" } ] }, { "product": "Linux", "vendor": "Linux", "defaultStatus": "affected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "fs/namespace.c" ], "versions": [ { "version": "6.5", "status": "affected" }, { "version": "0", "lessThan": "6.5", "status": "unaffected", "versionType": "semver" }, { "version": "6.6.89", "lessThanOrEqual": "6.6.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.12.26", "lessThanOrEqual": "6.12.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.14.5", "lessThanOrEqual": "6.14.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.15", "lessThanOrEqual": "*", "status": "unaffected", "versionType": "original_commit_for_fix" } ] } ], "cpeApplicability": [ { "nodes": [ { "operator": "OR", "negate": false, "cpeMatch": [ { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.5", "versionEndExcluding": "6.6.89" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.5", "versionEndExcluding": "6.12.26" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.5", "versionEndExcluding": "6.14.5" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.5", "versionEndExcluding": "6.15" } ] } ] } ], "references": [ { "url": "https://git.kernel.org/stable/c/4f435c1f4c48ff84968e2d9159f6fa41f46cf998" }, { "url": "https://git.kernel.org/stable/c/a61afd54826ac24c2c93845c4f441dbc344875b1" }, { "url": "https://git.kernel.org/stable/c/d4b21e8cd3d7efa2deb9cff534f0133e84f35086" }, { "url": "https://git.kernel.org/stable/c/0d039eac6e5950f9d1ecc9e410c2fd1feaeab3b6" } ], "title": "fix a couple of races in MNT_TREE_BENEATH handling by do_move_mount()", "x_generator": { "engine": "bippy-1.2.0" } } } }