In the Linux kernel, the following vulnerability has been resolved:
scsi: bsg: Fix TOCTOU in io_uring passthrough command setup
scsi_bsg_uring_cmd() reads bsg_uring_cmd from the shared mmap'd SQE.
Userspace can change a field after we check it and before we use it.
request_len is the sharp case: it can grow past sizeof(scmd->cmnd) after
the bound check and overflow scmd->cmnd in copy_from_user().
READ_ONCE() the SQE fields we check or use into locals before use.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 7.8
AV:L - scsi_bsg_uring_cmd() is reached only via a local io_uring IORING_OP_URING_CMD on a SCSI BSG device node (/dev/bsg/<h:c:i:l>); io_uring and BSG are local syscall/device paths, not a network protocol handler.
AC:L - The attacker owns both sides of the TOCTOU: one thread submits the uring_cmd while another rewrites request_len in the shared mmap'd SQE. The inline issue path never copies the SQE first, and scsi_alloc_request() sits between the bound check and copy_from_user, making the race attacker-driven and retryable.
PR:L - bsg_open() has no capability check; access is only DAC on /dev/bsg/* for ordinary SCSI devices. scsi_cmd_allowed() runs after the overflow. Disk/cdrom group membership and uaccess on removable SCSI/USB devices grant this to unprivileged local users without init-namespace root.
UI:N - The attacker opens the BSG node, creates an io_uring ring with SQE128/CQE32, and submits the racing passthrough command themselves; no victim action is required.
S:U - The overflow corrupts the blk-mq scsi_cmnd PDU and adjacent kernel heap in the same host kernel security authority, enabling local privilege escalation rather than a VM, IOMMU, or sandbox boundary crossing.
C:H - copy_from_user() overflows the 32-byte scmd->cmnd into scsi_cmnd pointer fields (sdb, sense_buffer, host_scribble) and adjacent heap with attacker-controlled bytes, which can be groomed into kernel memory disclosure.
I:H - The same attacker-controlled heap overflow overwrites kernel pointers and adjacent blk-mq request objects, providing a write primitive exploitable for control-flow hijacking and privilege escalation.
A:H - A large request_len smash or later use of corrupted scsi_cmnd pointers causes a kernel oops or panic; even a failed copy_from_user still writes through kernel memory until a fault, then frees the corrupted request.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
Low |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - scsi_bsg_uring_cmd() is reached only via a local io_uring IORING_OP_URING_CMD on a SCSI BSG device node (/dev/bsg/<h:c:i:l>); io_uring and BSG are local syscall/device paths, not a network protocol handler.
AC:L - The attacker owns both sides of the TOCTOU: one thread submits the uring_cmd while another rewrites request_len in the shared mmap'd SQE. The inline issue path never copies the SQE first, and scsi_alloc_request() sits between the bound check and copy_from_user, making the race attacker-driven and retryable.
PR:L - bsg_open() has no capability check; access is only DAC on /dev/bsg/* for ordinary SCSI devices. scsi_cmd_allowed() runs after the overflow. Disk/cdrom group membership and uaccess on removable SCSI/USB devices grant this to unprivileged local users without init-namespace root.
UI:N - The attacker opens the BSG node, creates an io_uring ring with SQE128/CQE32, and submits the racing passthrough command themselves; no victim action is required.
S:U - The overflow corrupts the blk-mq scsi_cmnd PDU and adjacent kernel heap in the same host kernel security authority, enabling local privilege escalation rather than a VM, IOMMU, or sandbox boundary crossing.
C:H - copy_from_user() overflows the 32-byte scmd->cmnd into scsi_cmnd pointer fields (sdb, sense_buffer, host_scribble) and adjacent heap with attacker-controlled bytes, which can be groomed into kernel memory disclosure.
I:H - The same attacker-controlled heap overflow overwrites kernel pointers and adjacent blk-mq request objects, providing a write primitive exploitable for control-flow hijacking and privilege escalation.
A:H - A large request_len smash or later use of corrupted scsi_cmnd pointers causes a kernel oops or panic; even a failed copy_from_user still writes through kernel memory until a fault, then frees the corrupted request.
CVSS 3.1