Critical CIFSwitch Vulnerability Found in Linux Kernel; Urgent Patch Advised

A critical security vulnerability, known as CIFSwitch, has been identified in the Linux kernel’s Common Internet File System (CIFS) client. This flaw allows unprivileged local users to escalate their privileges to root by exploiting a logic error between the kernel’s CIFS client and the userspace `cifs-utils` package. Security researcher Asim Manizada discovered this vulnerability and has provided a comprehensive technical analysis along with a proof-of-concept (PoC) to assist system administrators in assessing their systems’ exposure and implementing necessary patches.

Understanding the CIFSwitch Vulnerability

The CIFSwitch vulnerability arises from improper validation of key descriptions within the `cifs.spnego` key type. This oversight enables unprivileged users to impersonate trusted kernel requests, thereby initiating operations that require elevated privileges. The flaw was uncovered using an AI-assisted, multihop reasoning approach that constructs and navigates semantic graphs of security-relevant objects and flows, effectively chaining subtle logic flaws into a practical exploit.

The vulnerability was disclosed following an embargo coordinated with various Linux distributions, and upstream kernel patches have been made available to address the issue.

Technical Details of the Exploit

In Linux systems, CIFS/SMB serves as a widely adopted Windows-style network filesystem protocol. Within this framework, the kernel’s CIFS client manages core filesystem operations, while Kerberos/SPNEGO authentication is delegated to a root-privileged userspace helper, `cifs.upcall`, provided by the `cifs-utils` package. This interaction utilizes Linux keyrings: the kernel invokes `request_key()` for a `cifs.spnego` key, passing a trusted description string that encodes parameters such as server, user ID (UID), credential UID, process ID (PID), and namespace target. The `/sbin/request-key` policy then launches `cifs.upcall` as root to process the request.

Manizada’s research revealed that the kernel failed to verify whether the `cifs.spnego` key description genuinely originated from the CIFS subsystem before treating it as trusted. This omission allows any unprivileged process to directly invoke `request_key(cifs.spnego, , …)`. Since the key type is `cifs.spnego`, the default `request-key` rule still spawns `cifs.upcall` as root, even though the description is entirely controlled by the attacker.

The exploit chain relies on two elements within the forged description: `pid` and `upcall_target`. By setting `upcall_target=app` and supplying a malicious `pid`, the attacker causes `cifs.upcall` to switch into the namespaces of the attacker-controlled process before performing NSS-based account lookups and eventually dropping privileges. Within this attacker-controlled mount namespace, a rogue `nsswitch.conf` and malicious `libnss_.so.2` can be planted, allowing a root-privileged NSS lookup to load and execute arbitrary code.

In the provided PoC, the malicious NSS module writes an entry into `/etc/sudoers.d`, granting the attacker effective root access.

Conditions for Exploitation

The underlying kernel bug dates back to 2007. However, successful exploitation requires several conditions:

– A vulnerable kernel version.

– A compatible `cifs-utils` version (notably 6.14+ or older builds with backported changes).

– Unprivileged user namespace creation enabled.

– Linux Security Module (LSM) policies such as SELinux or AppArmor that do not block the attack path.

Testing indicates that many mainstream distributions are exploitable out of the box when `cifs-utils` is present, while others become exploitable after installing `cifs-utils` or relaxing default LSM policies.

Mitigation and Recommendations

To mitigate the CIFSwitch vulnerability, system administrators should take the following steps:

1. Update the Kernel: Apply the latest kernel patches that address the CIFSwitch vulnerability. These patches introduce a `vet_description` hook for the `cifs.spnego` key type, ensuring that only legitimate requests from the CIFS subsystem are processed.

2. Update `cifs-utils` Package: Ensure that the `cifs-utils` package is updated to a version that includes fixes for this vulnerability.

3. Review and Configure LSM Policies: Examine and, if necessary, strengthen SELinux or AppArmor policies to prevent unprivileged users from exploiting this vulnerability.

4. Restrict Unprivileged User Namespace Creation: Disable unprivileged user namespace creation if it is not required for your system’s operation. This can be achieved by setting the `kernel.unprivileged_userns_clone` parameter to `0`.

5. Monitor System Logs: Regularly review system logs for any unusual activity that may indicate attempts to exploit this vulnerability.

Conclusion

The CIFSwitch vulnerability underscores the importance of rigorous validation within kernel subsystems and the potential risks associated with interactions between kernel components and userspace utilities. By promptly applying the necessary patches and implementing the recommended mitigations, system administrators can protect their Linux systems from potential exploitation.

Twitter Post:

Alert: The CIFSwitch vulnerability in Linux allows local users to gain root access. Update your kernel and `cifs-utils` package immediately. #Linux #CyberSecurity #CIFSwitch

Focus Key Phrase:

CIFSwitch Linux kernel vulnerability

Article X Post:
Hashtags:
Article Key Phrase:
Category: Security News