HIGH Introduced in 6.3
ufs RpmbReply Overflow
CVE-2026-99157
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: scsi: bsg: Pass reply_len to bsg_setup_queue() to fit UFS ARPMB replies bsg-lib allocates a 96-byte (SCSI_SENSE_BUFFERSIZE) reply buffer per job, but struct ufs_rpmb_reply is 104 bytes: a 40-byte struct ufs_bsg_reply followed by a 64-byte EHS. When an Advanced RPMB command returns an EHS, ufshcd_advanced_rpmb_req_handler() copies it right after the 40-byte header and writes 8 bytes past the end of the buffer. Let each BSG transport pass its reply buffer size to bsg_setup_queue() and have ufs_bsg request sizeof(struct ufs_rpmb_reply), so the full reply reaches user space. Other transports keep SCSI_SENSE_BUFFERSIZE.
02KernelScan AI Analysis
Risk summary
A local attacker with access to the UFS BSG device interface can trigger an 8-byte heap buffer overflow when an Advanced RPMB command returns an Extra Header Segment (EHS). This memory corruption can lead to kernel privilege escalation, information disclosure, or denial of service. Systems with UFS storage supporting Advanced RPMB are affected.
Vulnerability analysis
The BSG (Block SCSI Generic) library allocates a fixed 96-byte reply buffer for each job, but the UFS Advanced RPMB reply structure requires 104 bytes (a 40-byte header plus a 64-byte EHS). When the UFS device returns an Advanced RPMB response containing an EHS, the handler copies the full 104-byte reply into the 96-byte buffer, writing 8 bytes past its end. The fix extends the BSG queue setup API so each transport can declare its required reply buffer size; the UFS driver now requests sizeof(struct ufs_rpmb_reply) while other transports retain the default SCSI_SENSE_BUFFERSIZE. The vulnerability is reachable by any local process that can open the UFS BSG device node (typically /dev/bsg/ufs-bsg-*) and issue Advanced RPMB commands, which generally requires membership in the disk group or CAP_SYS_RAWIO but not full root privileges.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.12 | 6.3 | 6.12.115 | bfb0582708b3 |
| 6.18 | 6.3 | 6.18.59 | 2effbe746452 |
| 6.6 | 6.3 | 6.6.161 | 913a1876fbe9 |
| 7.2 | 6.3 | 7.2.13 | 7a755f6d47b8 |
| mainline | 6.3 | 7.3 | ec6b083915e8 |
| cip/6.12 | 6.3 | 6.12.117-cip35 | bfb0582708b3 |
04CIP Kernels
State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.
| CIP tree | State |
|---|---|
| cip/6.12 | Fixed in 6.12.117-cip35 |