Skip to main content

CVE-2024-42318: Vulnerability in Linux Linux

High
VulnerabilityCVE-2024-42318cvecve-2024-42318
Published: Sat Aug 17 2024 (08/17/2024, 09:09:31 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: landlock: Don't lose track of restrictions on cred_transfer When a process' cred struct is replaced, this _almost_ always invokes the cred_prepare LSM hook; but in one special case (when KEYCTL_SESSION_TO_PARENT updates the parent's credentials), the cred_transfer LSM hook is used instead. Landlock only implements the cred_prepare hook, not cred_transfer, so KEYCTL_SESSION_TO_PARENT causes all information on Landlock restrictions to be lost. This basically means that a process with the ability to use the fork() and keyctl() syscalls can get rid of all Landlock restrictions on itself. Fix it by adding a cred_transfer hook that does the same thing as the existing cred_prepare hook. (Implemented by having hook_cred_prepare() call hook_cred_transfer() so that the two functions are less likely to accidentally diverge in the future.)

AI-Powered Analysis

AILast updated: 06/29/2025, 07:11:01 UTC

Technical Analysis

CVE-2024-42318 is a privilege restriction bypass vulnerability found in the Linux kernel's Landlock security module. Landlock is a Linux Security Module (LSM) designed to enforce fine-grained access control restrictions on processes, limiting their capabilities to improve security. The vulnerability arises from an inconsistency in how Landlock handles credential (cred) updates during certain operations. Normally, when a process's credentials are replaced, the Linux kernel invokes the cred_prepare LSM hook, which Landlock implements to maintain its restrictions on the process. However, in the special case where the keyctl() syscall is used with the KEYCTL_SESSION_TO_PARENT command, the kernel invokes the cred_transfer LSM hook instead of cred_prepare. Landlock does not implement the cred_transfer hook, causing it to lose track of the restrictions on the process's credentials. This means that a process capable of invoking fork() and keyctl(KEYCTL_SESSION_TO_PARENT) syscalls can effectively remove all Landlock restrictions on itself, bypassing the intended security controls. The fix involves implementing the cred_transfer hook in Landlock to mirror the behavior of cred_prepare, ensuring that restrictions persist even when credentials are transferred via keyctl. This vulnerability affects Linux kernel versions containing the specified commit hashes prior to the fix. There are no known exploits in the wild at the time of publication, and no CVSS score has been assigned yet.

Potential Impact

For European organizations relying on Linux systems with Landlock enabled for sandboxing or restricting process capabilities, this vulnerability could allow local attackers or compromised processes to escalate privileges or escape confinement. This undermines the integrity and confidentiality guarantees provided by Landlock, potentially allowing malicious code to access sensitive data or perform unauthorized actions. The impact is particularly significant in environments where Landlock is used to sandbox untrusted code, such as container runtimes, multi-tenant cloud platforms, or security-focused endpoints. While remote exploitation is unlikely without prior local access, the vulnerability increases the risk of privilege escalation and lateral movement within affected systems. This could lead to data breaches, disruption of services, or compromise of critical infrastructure. Given the widespread use of Linux in European government, financial, industrial, and cloud environments, the vulnerability poses a meaningful risk if left unpatched.

Mitigation Recommendations

1. Apply the latest Linux kernel updates that include the patch for CVE-2024-42318 as soon as they become available. 2. Audit and monitor the use of keyctl() syscalls, especially KEYCTL_SESSION_TO_PARENT, to detect suspicious activity that might indicate attempts to exploit this vulnerability. 3. Restrict the ability to invoke keyctl() and fork() syscalls to trusted processes only, using mandatory access controls or seccomp filters where feasible. 4. Employ defense-in-depth by combining Landlock with other security mechanisms such as SELinux, AppArmor, or container runtime security features to reduce reliance on a single LSM. 5. Conduct regular security reviews and penetration testing focusing on sandbox escape techniques to identify if this or similar vulnerabilities are exploitable in your environment. 6. Educate developers and system administrators about the limitations of Landlock and the importance of timely patching.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-07-30T07:40:12.278Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9828c4522896dcbe1f12

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

Last enriched: 6/29/2025, 7:11:01 AM

Last updated: 8/15/2025, 7:21:32 AM

Views: 17

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