Linux Kernel ksmbd Remote Code Execution Vulnerability

Note: This bulletin was written by Eric Dodge of the Kudelski Security Threat Detection & Research Team

Summary

The Zero Day Initiative (ZDI) recently disclosed the existence of a critical severity vulnerability discovered in newer versions of the Linux Kernel, specifically with the implementation of Kernel space implementation of SMB (ksmbd). The flaw exists within how the kernel handles the processing of certain SMB2 commands.

It is important to note that this vulnerability only applies to those systems with ksmbd enabled and that have SMB exposed to the network. Additionally, the vulnerability was introduced with Linux Kernel version 5.15 (released in November of 2021) and the KSMBD module is considered experimental and not enabled by default.

It is unlikely that ksmbd is used broadly by organizations as most deployments that require SMB support are likely running Samba instead.

The Cyber Fusion Center strongly encourages organizations who have enabled Kernel Space SMB support via ksmbd to apply patches as soon as possible.

Affected Systems

This vulnerability impacts Linux systems running Kernel 5.15 that also have the Kernel space implementation of SMB (ksmbd) enabled, which was introduced with the Linux Kernel 5.15.

Technical Details (limited at this time)

Successful exploitation of this vulnerability does not require authentication, and to date only requires that ksmbd is enabled on the host. Ksmbd was introduced with Linux 5.15. Proper exploitation of SMB2_TREE_DISCONNECT commands will allow a remote attacker to execute arbitrary code on the impacted systems and enable them to leak memory (Similar to the heartbleed vulnerability).

The vulnerability stems from the lack of validation of the existence of an object, prior to performing operations on the object. Using this an attacker can leverage the vulnerability to then execute code that is in the context of the kernel.

Solution / Workarounds

The current recommendation is to patch all impacted systems to the 5.15.61 kernel version.As this is a fairly new version of the Linux Kernel, please consult your Operating System’s Maintainer to understand how this vulnerability is being addressed

What the Cyber Fusion Center is doing

The CFC will continue to keep up to date with this vulnerability to provide further updates as they become available.

Sources

https://www.zerodayinitiative.com/advisories/ZDI-22-1690/

https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.61

https://www.kernel.org/doc/html/latest/filesystems/cifs/ksmbd.html

Leave a Reply