{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2024-50066",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2024-10-21T19:36:19.939Z",
        "datePublished": "2024-10-23T05:20:37.942Z",
        "dateUpdated": "2026-08-05T11:41:21.487Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T11:41:21.487Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nmm/mremap: fix move_normal_pmd/retract_page_tables race\n\nIn mremap(), move_page_tables() looks at the type of the PMD entry and the\nspecified address range to figure out by which method the next chunk of\npage table entries should be moved.\n\nAt that point, the mmap_lock is held in write mode, but no rmap locks are\nheld yet.  For PMD entries that point to page tables and are fully covered\nby the source address range, move_pgt_entry(NORMAL_PMD, ...) is called,\nwhich first takes rmap locks, then does move_normal_pmd(). \nmove_normal_pmd() takes the necessary page table locks at source and\ndestination, then moves an entire page table from the source to the\ndestination.\n\nThe problem is: The rmap locks, which protect against concurrent page\ntable removal by retract_page_tables() in the THP code, are only taken\nafter the PMD entry has been read and it has been decided how to move it. \nSo we can race as follows (with two processes that have mappings of the\nsame tmpfs file that is stored on a tmpfs mount with huge=advise); note\nthat process A accesses page tables through the MM while process B does it\nthrough the file rmap:\n\nprocess A                      process B\n=========                      =========\nmremap\n  mremap_to\n    move_vma\n      move_page_tables\n        get_old_pmd\n        alloc_new_pmd\n                      *** PREEMPT ***\n                               madvise(MADV_COLLAPSE)\n                                 do_madvise\n                                   madvise_walk_vmas\n                                     madvise_vma_behavior\n                                       madvise_collapse\n                                         hpage_collapse_scan_file\n                                           collapse_file\n                                             retract_page_tables\n                                               i_mmap_lock_read(mapping)\n                                               pmdp_collapse_flush\n                                               i_mmap_unlock_read(mapping)\n        move_pgt_entry(NORMAL_PMD, ...)\n          take_rmap_locks\n          move_normal_pmd\n          drop_rmap_locks\n\nWhen this happens, move_normal_pmd() can end up creating bogus PMD entries\nin the line `pmd_populate(mm, new_pmd, pmd_pgtable(pmd))`.  The effect\ndepends on arch-specific and machine-specific details; on x86, you can end\nup with physical page 0 mapped as a page table, which is likely\nexploitable for user->kernel privilege escalation.\n\nFix the race by letting process B recheck that the PMD still points to a\npage table after the rmap locks have been taken.  Otherwise, we bail and\nlet the caller fall back to the PTE-level copying path, which will then\nbail immediately at the pmd_none() check.\n\nBug reachability: Reaching this bug requires that you can create\nshmem/file THP mappings - anonymous THP uses different code that doesn't\nzap stuff under rmap locks.  File THP is gated on an experimental config\nflag (CONFIG_READ_ONLY_THP_FOR_FS), so on normal distro kernels you need\nshmem THP to hit this bug.  As far as I know, getting shmem THP normally\nrequires that you can mount your own tmpfs with the right mount flags,\nwhich would require creating your own user+mount namespace; though I don't\nknow if some distros maybe enable shmem THP by default or something like\nthat.\n\nBug impact: This issue can likely be used for user->kernel privilege\nescalation when it is reachable."
                }
            ],
            "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 - Both halves of the race are driven by local syscalls — `mremap()` in one process and `madvise(MADV_COLLAPSE)` in another (or background khugepaged) — against a shared tmpfs mapping. No network or physical access is involved.\nAC:L - The attacker controls both sides of the race: it runs process A's `mremap()` and process B's `MADV_COLLAPSE` on the same tmpfs file, and the window sits around a documented preemption/allocation point between `alloc_new_pmd()` and `move_pgt_entry(NORMAL_PMD, ...)`, so it can be widened with CPU pinning/memory pressure and retried indefinitely. Setting up shmem THP is an attacker-performed runtime action (`mount -t tmpfs -o huge=advise` inside its own user+mount namespace), not a condition beyond its control.\nPR:L - An ordinary unprivileged local user suffices — `mremap()` and `madvise(MADV_COLLAPSE)` have no capability checks, and the tmpfs `huge=` option is explicitly ungated (only `noswap`/`quota` require init_user_ns + CAP_SYS_ADMIN), so the required shmem THP mount is obtainable via unprivileged user+mount namespaces, which are enabled by default on major distros.\nUI:N - The attacker spawns and drives both racing processes itself; no victim action, mount, or file access by another user is required.\nS:U - This is a standard local kernel privilege escalation — the corruption occurs in kernel page tables and the impact stays within the same security authority (the OS kernel), with no VM/IOMMU boundary crossed.\nC:H - Physical page 0 gets installed as a live user-accessible page table, so its arbitrary contents are interpreted as PTEs, mapping attacker-reachable physical memory into userspace and enabling disclosure of kernel memory and other processes' data.\nI:H - The bogus page table yields an arbitrary physical memory write primitive (PTEs derived from page 0 carry `_PAGE_RW|_PAGE_USER`), allowing overwrite of kernel data such as `cred` structures; the reporter states it is likely exploitable for user->kernel privilege escalation.\nA:H - Corrupting the page-table tree with PFN 0, hitting `VM_BUG_ON`, and later freeing physical page 0 into the buddy allocator reliably produces kernel oops/panic and system-wide memory corruption."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "mm/mremap.c"
                    ],
                    "versions": [
                        {
                            "version": "1d65b771bc08cd054cf6d3766a72e113dc46d62f",
                            "lessThan": "17396e32f975130b3e6251f024c8807d192e4c3e",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1d65b771bc08cd054cf6d3766a72e113dc46d62f",
                            "lessThan": "1552ce9ce8af47c0fe911682e5e1855e25851ca9",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1d65b771bc08cd054cf6d3766a72e113dc46d62f",
                            "lessThan": "6fa1066fc5d00cb9f1b0e83b7ff6ef98d26ba2aa",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "mm/mremap.c"
                    ],
                    "versions": [
                        {
                            "version": "6.6",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.6",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.58",
                            "lessThanOrEqual": "6.6.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.11.5",
                            "lessThanOrEqual": "6.11.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12",
                            "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.6",
                                    "versionEndExcluding": "6.6.58"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.6",
                                    "versionEndExcluding": "6.11.5"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.6",
                                    "versionEndExcluding": "6.12"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/17396e32f975130b3e6251f024c8807d192e4c3e"
                },
                {
                    "url": "https://git.kernel.org/stable/c/1552ce9ce8af47c0fe911682e5e1855e25851ca9"
                },
                {
                    "url": "https://git.kernel.org/stable/c/6fa1066fc5d00cb9f1b0e83b7ff6ef98d26ba2aa"
                },
                {
                    "url": "https://project-zero.issues.chromium.org/issues/371047675"
                }
            ],
            "title": "mm/mremap: fix move_normal_pmd/retract_page_tables race",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        },
        "adp": [
            {
                "problemTypes": [
                    {
                        "descriptions": [
                            {
                                "type": "CWE",
                                "cweId": "CWE-362",
                                "lang": "en",
                                "description": "CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')"
                            }
                        ]
                    }
                ],
                "affected": [
                    {
                        "vendor": "linux",
                        "product": "linux_kernel",
                        "cpes": [
                            "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*"
                        ],
                        "defaultStatus": "unknown",
                        "versions": [
                            {
                                "version": "6.6",
                                "status": "affected",
                                "lessThan": "6.6.58",
                                "versionType": "custom"
                            },
                            {
                                "version": "6.6.58",
                                "status": "unaffected",
                                "lessThan": "6.7",
                                "versionType": "custom"
                            },
                            {
                                "version": "6.11.5",
                                "status": "unaffected",
                                "lessThan": "6.12",
                                "versionType": "custom"
                            },
                            {
                                "version": "6.12",
                                "status": "unaffected",
                                "lessThan": "*",
                                "versionType": "custom"
                            },
                            {
                                "version": "1d65b771bc08",
                                "status": "affected",
                                "lessThan": "17396e32f975",
                                "versionType": "git"
                            },
                            {
                                "version": "1d65b771bc08",
                                "status": "affected",
                                "lessThan": "1552ce9ce8af",
                                "versionType": "git"
                            },
                            {
                                "version": "1d65b771bc08",
                                "status": "affected",
                                "lessThan": "6fa1066fc5d0",
                                "versionType": "git"
                            }
                        ]
                    }
                ],
                "metrics": [
                    {
                        "cvssV3_1": {
                            "scope": "UNCHANGED",
                            "version": "3.1",
                            "baseScore": 7,
                            "attackVector": "LOCAL",
                            "baseSeverity": "HIGH",
                            "vectorString": "CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
                            "integrityImpact": "HIGH",
                            "userInteraction": "NONE",
                            "attackComplexity": "HIGH",
                            "availabilityImpact": "HIGH",
                            "privilegesRequired": "LOW",
                            "confidentialityImpact": "HIGH"
                        }
                    },
                    {
                        "other": {
                            "type": "ssvc",
                            "content": {
                                "timestamp": "2024-11-23T04:55:50.463779Z",
                                "id": "CVE-2024-50066",
                                "options": [
                                    {
                                        "Exploitation": "poc"
                                    },
                                    {
                                        "Automatable": "no"
                                    },
                                    {
                                        "Technical Impact": "total"
                                    }
                                ],
                                "role": "CISA Coordinator",
                                "version": "2.0.3"
                            }
                        }
                    }
                ],
                "title": "CISA ADP Vulnrichment",
                "providerMetadata": {
                    "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
                    "shortName": "CISA-ADP",
                    "dateUpdated": "2024-11-25T14:12:03.999Z"
                }
            },
            {
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2025-03-07T16:19:11.266Z"
                },
                "references": [
                    {
                        "url": "https://www.vicarius.io/vsociety/posts/cve-2024-50066-kernel-mitigation-vulnerability"
                    },
                    {
                        "url": "https://www.vicarius.io/vsociety/posts/cve-2024-50066-kernel-detection-vulnerability"
                    }
                ],
                "title": "CVE Program Container",
                "x_generator": {
                    "engine": "ADPogram 0.0.1"
                }
            }
        ]
    }
}