{"id":"CVE-2024-27007","state":"PUBLISHED","title":"userfaultfd: change src_folio after ensuring it's unpinned in UFFDIO_MOVE","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nuserfaultfd: change src_folio after ensuring it's unpinned in UFFDIO_MOVE\n\nCommit d7a08838ab74 (\"mm: userfaultfd: fix unexpected change to src_folio\nwhen UFFDIO_MOVE fails\") moved the src_folio->{mapping, index} changing to\nafter clearing the page-table and ensuring that it's not pinned.  This\navoids failure of swapout+migration and possibly memory corruption.\n\nHowever, the commit missed fixing it in the huge-page case.","publishedAt":"2024-05-01T05:29:08.528Z","updatedAt":"2026-08-05T11:28:57.017Z","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":"adef440691bab824e39c1b17382322d195e1fab0","status":"affected","lessThan":"df5f6e683e7f21a15d8be6e7a0c7a46436963ebe","versionType":"git"},{"version":"adef440691bab824e39c1b17382322d195e1fab0","status":"affected","lessThan":"c0205eaf3af9f5db14d4b5ee4abacf4a583c3c50","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/huge_memory.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.8.8","status":"unaffected","lessThanOrEqual":"6.8.*","versionType":"semver"},{"version":"6.9","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/huge_memory.c"]}],"references":["https://git.kernel.org/stable/c/df5f6e683e7f21a15d8be6e7a0c7a46436963ebe","https://git.kernel.org/stable/c/c0205eaf3af9f5db14d4b5ee4abacf4a583c3c50","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DAMSOZXJEPUOXW33WZYWCVAY7Z5S7OOY/","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4EZ6PJW7VOZ224TD7N4JZNU6KV32ZJ53/","https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCBZZEC7L7KTWWAS2NLJK6SO3IZIL4WW/"],"weaknesses":[],"ingestedAt":"2026-10-29T20:07:10.607Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/27xxx/CVE-2024-27007.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-27007","state":"PUBLISHED","datePublished":"2024-05-01T05:29:08.528Z","dateUpdated":"2026-08-05T11:28:57.017Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-02-19T14:20:24.208Z"},"containers":{"cna":{"title":"userfaultfd: change src_folio after ensuring it's unpinned in UFFDIO_MOVE","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nuserfaultfd: change src_folio after ensuring it's unpinned in UFFDIO_MOVE\n\nCommit d7a08838ab74 (\"mm: userfaultfd: fix unexpected change to src_folio\nwhen UFFDIO_MOVE fails\") moved the src_folio->{mapping, index} changing to\nafter clearing the page-table and ensuring that it's not pinned.  This\navoids failure of swapout+migration and possibly memory corruption.\n\nHowever, the commit missed fixing it in the huge-page case."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"adef440691bab824e39c1b17382322d195e1fab0","status":"affected","lessThan":"df5f6e683e7f21a15d8be6e7a0c7a46436963ebe","versionType":"git"},{"version":"adef440691bab824e39c1b17382322d195e1fab0","status":"affected","lessThan":"c0205eaf3af9f5db14d4b5ee4abacf4a583c3c50","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/huge_memory.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.8.8","status":"unaffected","lessThanOrEqual":"6.8.*","versionType":"semver"},{"version":"6.9","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/huge_memory.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/df5f6e683e7f21a15d8be6e7a0c7a46436963ebe"},{"url":"https://git.kernel.org/stable/c/c0205eaf3af9f5db14d4b5ee4abacf4a583c3c50"}],"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 bug is reached only through the `UFFDIO_MOVE` ioctl on a local userfaultfd file descriptor obtained via the `userfaultfd(2)` syscall or `/dev/userfaultfd`, operating on the caller's own address space. There is no remote or adjacent-network path to `move_pages_huge_pmd()`.\nAC:L - The attacker controls both sides of the race, looping `UFFDIO_MOVE` in one thread against `pin_user_pages_fast()` (io_uring buffer registration, vmsplice, O_DIRECT) in another on the same attacker-owned THP, and all preconditions (two anon writable VMAs, uffd registration, `MADV_HUGEPAGE`) are self-supplied. Losing an attempt costs nothing but an `-EBUSY`, so the race can be retried indefinitely until won.\nPR:L - Any unprivileged local user can obtain the context — `userfaultfd_syscall_allowed()` unconditionally permits `UFFD_USER_MODE_ONLY` irrespective of the `vm.unprivileged_userfaultfd` sysctl, and `/dev/userfaultfd` is ungated (world-usable on Android/ChromeOS, the primary `UFFDIO_MOVE` consumers). Neither `userfaultfd_move()` nor `validate_move_areas()` performs any capability check.\nUI:N - A single attacker process drives the entire sequence — allocate the THP, register the uffd, race `UFFDIO_MOVE` against a GUP pin, then `munmap()` the dst VMA. No victim action or cooperation is involved.\nS:U - The corrupted rmap metadata, the freed `anon_vma`, and any resulting escalation are all kernel objects within the same security authority. No hypervisor, IOMMU, or sandbox boundary is crossed.\nC:H - The stale `folio->mapping` breaks the invariant asserted in `folio_get_anon_vma()` (`mm/rmap.c:518-524`), yielding a use-after-free on a `SLAB_TYPESAFE_BY_RCU` `anon_vma` that an attacker can groom and reuse; subsequent rmap walks operate on the wrong anon_vma/index, and the mis-indexed folio can be migrated or reclaimed into an unrelated mapping, exposing arbitrary memory contents.\nI:H - The dangling `anon_vma` gives an `atomic_inc_not_zero()` write into freed, attacker-reusable slab memory, and rmap operations mutate PTE state through the wrong anon_vma interval tree — both upstream commits explicitly state the invalid rmap \"possibly result[s] in memory corruption,\" which is leverageable for control-flow hijack.\nA:H - The use-after-free on the freed `anon_vma`, plus reachable `VM_BUG_ON` assertions in `__page_check_anon_rmap()` and the `split_huge_page`/migration paths, produce kernel oopses and panics. Swapout and migration of the affected folio also permanently fail because its mappings can no longer be located."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:28:57.017Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.8.8"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.9"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2024-06-17T17:40:30.411881Z","id":"CVE-2024-27007","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-06-17T17:46:11.249Z"}},{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/df5f6e683e7f21a15d8be6e7a0c7a46436963ebe","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/c0205eaf3af9f5db14d4b5ee4abacf4a583c3c50","tags":["x_transferred"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DAMSOZXJEPUOXW33WZYWCVAY7Z5S7OOY/"},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4EZ6PJW7VOZ224TD7N4JZNU6KV32ZJ53/"},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GCBZZEC7L7KTWWAS2NLJK6SO3IZIL4WW/"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-04T17:16:42.236Z"}}]}}}