A vulnerability that lurked in the Linux kernel for 19 years allows low-privileged users to obtain root-level privileges on numerous distributions.
Dubbed CIFSwitch, the issue impacts the Linux kernel’s CIFS subsystem and the cifs-utils userspace helper it uses for handling authentication. CIFS handles parts of the SMB network filesystem protocol, such as mounting shares, read/write actions, and SMB communication to the server.
When authenticating a mount, the subsystem sends a request_key call for a cifs.spnego key. The request checks the key in userspace and calls cifs.upcall as root to parse the key description, which contains fields such as UID, PID, credential cache, and namespace.
According to SpaceX security engineer Asim Viladi Oglu Manizada, the kernel does not check the origin of the request and the key description, which allows an attacker to call the request_key function directly and can supply their own key description fields, bypassing CIFS origin.
Because cifs.upcall is called as root, the helper switches into the namespaces of the PID supplied in the modified key description, providing the attacker with root access.
Furthermore, during the operation, before privileges are dropped, the helper also performs account lookup, which goes through Name Service Switch (NSS) and enables the loading of NSS modules.
The attacker can abuse this by placing a fake NSS config file and an NSS module in their namespace, which results in the helper loading the attacker-controlled code as root, Manizada says.
According to the engineer, the vulnerability can be resolved by considering key descriptions as legitimate only when CIFS uses its private spnego_cred, and by implementing user-space hardening to check if the key description is indeed kernel-generated.
Certain Linux Mint, CentOS, Rocky Linux, Kali Linux, AlmaLinux, and SLES SAP distributions that have cifs-utils installed by default are vulnerable. According to the researcher, some distros are vulnerable only if cifs-utils was manually installed.
Many Ubuntu, Fedora, CentOS, Rocky Linux, AlmaLinux, Oracle Linux, openSUSE, and SLES distros block the execution path by default, while Amazon Linux 2 KVM and Kali Linux 2019.4/2020.4 are not affected.
Major Linux distributions rolled out fixes for the security defect earlier this month. Manizada has published proof-of-concept (PoC) code to help defenders “validate patches, mitigations, detections, and exposure”.
Related: PoC Released for DirtyDecrypt Linux Kernel Vulnerability
Related: New Linux Kernel Vulnerability Fragnesia Allows Root Privilege Escalation
Related: New ‘Dirty Frag’ Linux Vulnerability Possibly Exploited in Attacks
Related: Exploitation of ‘Copy Fail’ Linux Vulnerability Begins
