smb: client: fix use-after-free in crypt_message when using async crypto
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ b0abcd65ec545701b8793e12bc27dc98042b151a · < 8ac90f6824fc44d2e55a82503ddfc95defb19ae0| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix use-after-free in crypt_message when using async crypto
The CVE-2024-50047 fix removed asynchronous crypto handling from crypt_message(), assuming all crypto operations are synchronous. However, when hardware crypto accelerators are used, this can cause use-after-free crashes:
crypt_message() // Allocate the creq buffer containing the req creq = smb2_get_aead_req(..., &req);
// Async encryption returns -EINPROGRESS immediately rc = enc ? crypto_aead_encrypt(req) : crypto_aead_decrypt(req);
// Free creq while async operation is still in progress kvfree_sensitive(creq, ...);
Hardware crypto modules often implement async AEAD operations for performance. When crypto_aead_encrypt/decrypt() returns -EINPROGRESS, the operation completes asynchronously. Without crypto_wait_req(), the function immediately frees the request buffer, leading to crashes when the driver later accesses the freed memory.
This results in a use-after-free condition when the hardware crypto driver later accesses the freed request structure, leading to kernel crashes with NULL pointer dereferences.
From the CVE record · Linux
The Linux kernel SMB client can free a crypto request while an asynchronous hardware crypto operation is still running. When the driver later accesses that request, a use-after-free can cause a kernel crash. The input does not specify whether exploitation requires network access, authentication, or user interaction.
Engineers running Linux kernels with the SMB client should check for this issue, particularly where hardware crypto accelerators are used; affected versions are not specified.