CVE-2021-47182
Last modified
CVE-2021-47182 is a medium-severity vulnerability rated 5.5/10 on the CVSS scale. In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix scsi_mode_sense() buffer length handling Several problems exist with scsi_mode_sense() buffer length handling: 1) The allocation length field of the MODE SENSE(10) command is 16-bits, occupying bytes 7 and 8 of the CDB. With this command, access to mode pages larger than 255 bytes is thus possible. EPSS estimates a 0.20% chance of exploitation in the next 30 days.
Description
In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix scsi_mode_sense() buffer length handling Several problems exist with scsi_mode_sense() buffer length handling: 1) The allocation length field of the MODE SENSE(10) command is 16-bits, occupying bytes 7 and 8 of the CDB. With this command, access to mode pages larger than 255 bytes is thus possible. However, the CDB allocation length field is set by assigning len to byte 8 only, thus truncating buffer length larger than 255. 2) If scsi_mode_sense() is called with len smaller than 8 with sdev->use_10_for_ms set, or smaller than 4 otherwise, the buffer length is increased to 8 and 4 respectively, and the buffer is zero filled with these increased values, thus corrupting the memory following the buffer. Fix these 2 problems by using put_unaligned_be16() to set the allocation length field of MODE SENSE(10) CDB and by returning an error when len is too small. Furthermore, if len is larger than 255B, always try MODE SENSE(10) first, even if the device driver did not set sdev->use_10_for_ms. In case of invalid opcode error for MODE SENSE(10), access to mode pages larger than 255 bytes are not retried using MODE SENSE(6). To avoid buffer length overflows for the MODE_SENSE(10) case, check that len is smaller than 65535 bytes. While at it, also fix the folowing: * Use get_unaligned_be16() to retrieve the mode data length and block descriptor length fields of the mode sense reply header instead of using an open coded calculation. * Fix the kdoc dbd argument explanation: the DBD bit stands for Disable Block Descriptor, which is the opposite of what the dbd argument description was.
Metrics
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Weakness Enumeration
Affected Software
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux Kernel | < 5.15.5 |
References
Timeline
- Published
- Last Modified
- Status
- Analyzed
Frequently Asked Questions
What is CVE-2021-47182?
How severe is CVE-2021-47182?
How do I fix CVE-2021-47182?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2021
- CVE-2021-47176In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47177In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47178In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47179In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47180In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47181In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47183In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47184In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47185In the Linux kernel, the following vulnerability has been re…4.4
- CVE-2021-47186In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47187In the Linux kernel, the following vulnerability has been re…5.5
- CVE-2021-47188In the Linux kernel, the following vulnerability has been re…5.5
Are you affected by CVE-2021-47182?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
