Skip to main content

CVE-2024-47745: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-47745cvecve-2024-47745
Published: Mon Oct 21 2024 (10/21/2024, 12:14:12 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: mm: call the security_mmap_file() LSM hook in remap_file_pages() The remap_file_pages syscall handler calls do_mmap() directly, which doesn't contain the LSM security check. And if the process has called personality(READ_IMPLIES_EXEC) before and remap_file_pages() is called for RW pages, this will actually result in remapping the pages to RWX, bypassing a W^X policy enforced by SELinux. So we should check prot by security_mmap_file LSM hook in the remap_file_pages syscall handler before do_mmap() is called. Otherwise, it potentially permits an attacker to bypass a W^X policy enforced by SELinux. The bypass is similar to CVE-2016-10044, which bypass the same thing via AIO and can be found in [1]. The PoC: $ cat > 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); // show the RWX page exists even if W^X policy is enforced int fd = open("/proc/self/maps", O_RDONLY); unsigned char buf2[1024]; while (1) { int ret = read(fd, buf2, 1024); if (ret <= 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 (deleted) [PM: subject line tweaks]

AI-Powered Analysis

AILast updated: 06/28/2025, 20:25:14 UTC

Technical Analysis

CVE-2024-47745 is a security vulnerability identified in the Linux kernel related to the handling of memory mapping permissions in the remap_file_pages() system call. Specifically, the vulnerability arises because remap_file_pages() calls do_mmap() directly without invoking the Linux Security Module (LSM) hook security_mmap_file(), which is responsible for enforcing security policies such as those implemented by SELinux. When a process sets its personality flag to READ_IMPLIES_EXEC and then calls remap_file_pages() on read-write (RW) pages, the pages can be remapped with read-write-execute (RWX) permissions. This effectively bypasses the W^X (write xor execute) policy enforced by SELinux, which is designed to prevent memory regions from being simultaneously writable and executable, a critical mitigation against code injection and exploitation techniques. The vulnerability is reminiscent of CVE-2016-10044, which involved a similar bypass via asynchronous I/O (AIO). The provided proof-of-concept (PoC) demonstrates how an attacker can create a memory region with RWX permissions despite W^X enforcement by manipulating personality flags and remapping file pages. This vulnerability affects Linux kernel versions identified by the commit hash 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 and likely other versions prior to the patch. No known exploits are currently reported in the wild, and no CVSS score has been assigned yet. The core issue is a missing security check in remap_file_pages(), allowing privilege escalation or code execution in contexts where SELinux policies are expected to prevent such behavior.

Potential Impact

For European organizations, this vulnerability poses a significant risk, especially for those relying on SELinux for enforcing strict memory protection policies on Linux-based servers and infrastructure. The ability to bypass W^X policies can allow attackers to execute arbitrary code in memory regions that should be non-executable, facilitating exploitation of other vulnerabilities or direct privilege escalation. This can compromise confidentiality, integrity, and availability of critical systems. Organizations running sensitive workloads, such as financial services, government, healthcare, and critical infrastructure, which often deploy SELinux for enhanced security, are particularly at risk. The vulnerability could be exploited by local attackers or malicious insiders who have the ability to execute code on affected systems, or potentially by remote attackers if combined with other vulnerabilities. The lack of user interaction requirement and the direct kernel-level nature of the flaw increase the severity. While no active exploitation is reported, the presence of a PoC indicates that weaponization is feasible, raising the urgency for mitigation.

Mitigation Recommendations

European organizations should prioritize patching Linux kernels to versions where this vulnerability is fixed, ensuring that remap_file_pages() properly invokes the security_mmap_file() LSM hook. Until patches are applied, organizations should: 1) Audit and restrict the use of the personality syscall, especially the READ_IMPLIES_EXEC flag, limiting it to trusted applications only. 2) Monitor system calls related to remap_file_pages and personality changes using kernel auditing tools (e.g., auditd) to detect suspicious activity. 3) Employ additional runtime protections such as SELinux targeted policies with enhanced logging and enforcement modes to detect anomalous memory mappings. 4) Restrict access to memfd_create and related syscalls to minimize the attack surface. 5) Conduct thorough code reviews and vulnerability assessments on custom or third-party software that may invoke these syscalls. 6) Implement defense-in-depth strategies including mandatory access controls, application whitelisting, and kernel hardening features like lockdown mode where applicable. 7) Educate system administrators and security teams about this vulnerability and the importance of timely kernel updates.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-09-30T16:00:12.960Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9825c4522896dcbe06af

Added to database: 5/21/2025, 9:08:53 AM

Last enriched: 6/28/2025, 8:25:14 PM

Last updated: 8/11/2025, 1:05:25 PM

Views: 28

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats