Newline injection in udev scsi_id lets malicious devices gain root
Key facts
- Attack vector
- Physical
- Privileges required
- None
- User interaction
- None
- Attack complexity
- High
- Impact type
- —
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · GHSA-m8q3-73v4-wvg7. Fix status from GitHub.
Summary
udev before 261 passes ID_WWN values from SCSI VPD page 83 data to its scsi_id helper without removing control characters. A malicious SCSI device with crafted WWN properties can inject a newline followed by a SYSTEMD_WANTS line, which starts a systemd unit of the attacker's choice (CWE-74). An attacker who plugs in such a device with physical access and no privileges can gain root.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
### Impact udev's `scsi_id` helper binary, which parses input from the kernel, is vulnerable to malicious devices being plugged in, with intentionally crafted properties exposed to the respective kernel driver, that send them down to userspace without sanitization. The `ID_WWN`, `ID_WWN_VENDOR_EXTENSION`, or `ID_WWN_WITH_EXTENSION` properties are derived from the hardware's SCSI metadata, which can be crafted to contain `\n SYSTEMD_WANTS=foobar.service` so that it can be used to activate a unit of the attacker's choice, including `debug-shell.service` which spawns a root console. ### Patches v261 (https://github.com/systemd/systemd/commit/5f700d148c44063c0f0dbb9fc136866339cd3fa7) v260.2 (https://github.com/systemd/systemd/commit/4a4d0838b890c86dd3a109fa629ead1607f16e64) v259.6 (https://github.com/systemd/systemd/commit/8ecee45b24ea90e3d9a0ee0e0a49450b32f8b39f) v258.8 (https://github.com/systemd/systemd/commit/d2d3aab7ab3267d75790d5375be15ea42b7e458b) ### Workarounds Disable the iscsi driver in the kernel ### References Original report follows below ## Summary The fix for GHSA-vpfq-8p5f-jcqx added newline/control-character validation before printing `ID_SCSI_SERIAL`, but equivalent validation was not added for `ID_WWN`, `ID_WWN_VENDOR_EXTENSION`, or `ID_WWN_WITH_EXTENSION`. Those fields are still derived from attacker-controlled SCSI VPD page 83 data through the same raw ASCII copy path and then printed into the newline-delimited `scsi_id --export` output without `utf8_is_valid()` or `string_has_cc()` checks. On current HEAD, this still allows a malicious SCSI device to inject an additional imported property line; I reproduced `SYSTEMD_WANTS=rescue.service` via `ID_WWN_WITH_EXTENSION`. Confirmed on HEAD (v260, commit 7ae0a58). ## Why This Is an Incomplete Fix The previous fix (commits 16325b35, 54f880b) addressed only `unit_serial_number` even though `wwn` and `wwn_vendor_extension` come from the same untrusted VPD page 83 data and are printed through the same newline-delimited export interface. `src/udev/scsi_id/scsi_id.c` line 445 -- fixed: if (dev_scsi.unit_serial_number[0] != '\0' && utf8_is_valid(dev_scsi.unit_serial_number) && !string_has_cc(dev_scsi.unit_serial_number, /* ok= */ NULL)) printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); Lines 435-441 -- not fixed: if (dev_scsi.wwn[0] != '\0') { printf("ID_WWN=0x%s\n", dev_scsi.wwn); if (dev_scsi.wwn_vendor_extension[0] != '\0') { printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); } else printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); } ## Affected Code Path `src/udev/scsi_id/scsi_serial.c`, `check_fill_0x83_id()`: 1. VPD page 83 descriptor with `code_set = SCSI_ID_ASCII` matches entries in `id_search_list` (lines 38, 40, 51) 2. Lines 500-505 -- raw byte copy, no filtering: while (i < (4 + page_83[3])) serial[j++] = page_83[i++]; 3. Lines 520-523 -- raw bytes go to wwn: strscpy(wwn, 17, serial + s); strscpy(wwn_vendor_extension, 17, serial + s + 16); A 0x0A (newline) in the VPD data passes through to wwn without sanitization. ## Exploit Mechanism `scsi_id --export` emits newline-delimited `KEY=value` records, and udev (`IMPORT{program}` in `60-persistent-storage.rules`) treats each line as a separate property. A newline inside `wwn` creates a new imported property. The combined `ID_WWN_WITH_EXTENSION=0x%s%s` output concatenates both wwn fields, providing enough post-newline bytes to carry `SYSTEMD_WANTS=rescue.service` (28 chars, within the 31-byte combined field capacity). ## Reproduction Standalone C program simulating the vulnerable ASCII VPD parsing and the final `printf()` calls. Its output matches the format consumed by udev from `scsi_id --export`: === Raw output from scsi_id (what udev receives) === ID_WWN=0x SYSTEMD_WANTS=r ID_WWN_VENDOR_EXTENSION=0xescue.service ID_WWN_WITH_EXTENSION=0x SYSTEMD_WANTS=rescue.service udev parses `SYSTEMD_WANTS=rescue.service` as a device property. systemd reads `SYSTEMD_WANTS` from device properties (`src/core/device.c:551-555`) and starts the specified unit. VPD page 83 descriptor for the injection: Byte 0: 0x02 (code_set = ASCII) Byte 1: 0x30 (id_type = NAA) Byte 3: 0x1d (identifier length = 29) Byte 4: 0x0a (newline) Bytes 5-33: "SYSTEMD_WANTS=rescue.service" ## Preconditions and Impact **Preconditions:** - Attacker can present a malicious SCSI device (USB mass storage gadget, iSCSI target, or virtual SCSI adapter) - Victim system runs the standard udev rule importing `scsi_id --export` output - Injected property is consumed by systemd device handling **Impact:** This recreates the same attack class as GHSA-vpfq-8p5f-jcqx: newline injection into helper output leading to unintended privileged property import. In the demonstrated case, the injected property is `SYSTEMD_WANTS=rescue.service`, which causes systemd to start a root-managed unit. ## Suggested Fix Apply the same validation used for `unit_serial_number` before printing wwn-derived fields, or reject/escape control characters before emitting any `KEY=value` output from `scsi_id --export`.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | udev (linux) | < 261 | 261 260.2 259.6 258.8 | Patch available | GHSA-m8q3-73v4-wvg7 |
- udev (linux) Vendor— Affected < 261 Fixed in 261 260.2 259.6 258.8 Patch available GHSA-m8q3-73v4-wvg7
Remediation
Update udev to a fixed version: 261, 260.2, 259.6 or 258.8. Until the update is applied, disable the iscsi driver in the kernel, which the source lists as a workaround.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-m8q3-73v4-wvg7 udev (linux) Fixed in 261 260.2 259.6 258.8 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-m8q3-73v4-wvg7
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences