CVE detail

CVE-2012-4542

Linux Kernel SG_IO ioctl Authorization Bypass via Overlapping SCSI Opcodes

MediumModified
CVSS4.6
EPSS
Exploitability5
Exploit refs0

Summary

A local privilege bypass in the Linux kernel's SCSI ioctl handling (CVE-2012-4542) allows unprivileged users to send unauthorized SCSI commands to devices, potentially leading to data exposure or device manipulation. Apply vendor patches and restrict access to SCSI generic devices.

Published

Mar 1, 2013

Last modified

Jun 17, 2026

CWE

CWE-264 · Permissions, Privileges, and Access Controls

Affected product

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc1:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc2:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc3:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc4:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc5:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc6:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0:rc7:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.1:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.2:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.3:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.4:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.5:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.6:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.7:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.8:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.9:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.10:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.11:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.12:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.13:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.14:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.15:*:*:*:*:*:*:* cpe:2.3:o:linux:linux_kernel:3.0.16:*:*:*:*:*:*:* … and 158 more affected CPE criteria

Why exploitable

Why Exploitable?

EPSS data is not available for this CVE, meaning there is no empirical probability score to gauge real-world exploitation likelihood. However, the absence of EPSS data does not imply low risk; it may reflect limited coverage or age of the vulnerability. CISA KEV does not list this CVE, and Watchstack has indexed no public exploits or PoCs, suggesting that active exploitation is not currently widespread or publicly documented. Nevertheless, this is a local privilege bypass in the Linux kernel's SCSI ioctl handling, which can allow unprivileged users to send unauthorized SCSI commands, potentially leading to data exposure or device manipulation. Organizations should validate whether their systems have the vulnerable kernel versions, apply vendor patches promptly, and restrict access to SCSI generic devices to mitigate risk. Even without public exploits, the technical impact is significant, and local attackers with access to a user account could exploit this to gain elevated privileges or manipulate storage devices.

Technical details

Overview

CVE-2012-4542 is a medium-severity vulnerability in the Linux kernel's block layer, specifically in the block/scsi_ioctl.c file. The flaw affects kernel versions up to and including 3.8. It allows local users to bypass intended access restrictions on SCSI devices by issuing SG_IO ioctl calls that leverage overlapping opcodes. The vulnerability was publicly disclosed and assigned a CVSS base score of 4.6, with an EPSS percentile of 28.2, indicating moderate exploitation likelihood. This issue is relevant to any Linux distribution using the affected kernel versions, including Debian, Ubuntu, Red Hat, CentOS, and Oracle Linux. Security teams should prioritize patching systems where local users have access to SCSI devices, especially in multi-tenant or shared environments.

Technical details

The root cause lies in the authorization logic within block/scsi_ioctl.c. The kernel fails to properly consider the SCSI device class when authorizing SCSI commands. Specifically, the sg_io() function checks permissions based on the opcode of the SCSI command, but due to overlapping opcodes, certain commands that should be restricted can be executed with lower privileges. This is a classic example of CWE-264 (Permissions, Privileges, and Access Controls). The vulnerable code path is triggered via the SG_IO ioctl, which allows user-space applications to send raw SCSI commands to devices. The attack requires local access to the system and the ability to open a SCSI generic device (e.g., /dev/sg*). The trust boundary is between unprivileged local users and the kernel's device access controls. An attacker can craft a malicious SCSI command that uses an opcode that overlaps with a permitted one, thereby bypassing the intended restrictions.

Impact

Successful exploitation could allow a local attacker to send arbitrary SCSI commands to storage devices, potentially leading to unauthorized data access, modification, or denial of service. In virtualized environments, this could also affect other tenants if the hypervisor passes through SCSI devices. The confidentiality impact is partial, as an attacker might read data from the device; integrity impact is also partial, as they could alter data; availability impact is partial, as they could disrupt device operation. For defenders, the primary concern is in environments with untrusted local users, such as shared hosting or academic labs. The vulnerability does not require special privileges, making it a viable vector for privilege escalation if the device has sensitive data.

Exploitation steps

  1. Identify a SCSI generic device (e.g., /dev/sg0) accessible to the user.
  2. Craft a custom SCSI command using the SG_IO ioctl with an opcode that overlaps with a permitted command.
  3. Open the device file with read/write permissions.
  4. Issue the SG_IO ioctl with the crafted command structure.
  5. Observe the kernel's response to determine if the command was executed.
  6. If successful, repeat with different opcodes to map out allowed commands.
  7. Use the unauthorized command to read, write, or disrupt the device.
  8. Clean up any traces by removing temporary files or logs.

Indicators of compromise

  • Unusual SG_IO ioctl calls in audit logs, especially from non-root users.
  • Unexpected SCSI commands appearing in kernel logs or device logs.
  • Anomalous access patterns to /dev/sg* devices from processes that normally do not interact with them.
  • System calls with ioctl on SCSI generic devices from user-space processes.
  • In EDR, look for processes that open SCSI devices and then issue ioctl commands with unusual opcodes.
  • Network indicators are unlikely, but if the device is network-attached, monitor for unexpected SCSI commands from the host.
  • Behavioral indicators: a user repeatedly probing different SCSI opcodes.
  • File integrity monitoring on device files may show unexpected access times.

Mitigation and workarounds

  • Apply the official kernel patches provided by your distribution. For example, Red Hat and Debian released updated kernels that fix this issue.
  • Upgrade to a kernel version that includes the fix (typically 3.8.13 or later, depending on the distribution).
  • As a workaround, restrict access to SCSI generic devices by setting appropriate permissions (e.g., chmod 600 /dev/sg* and ensuring only trusted users are in the disk group).
  • Use SELinux or AppArmor to confine processes that need access to SCSI devices.
  • Monitor and audit all ioctl calls on SCSI devices to detect suspicious activity.
  • If possible, disable the SCSI generic driver if not needed.

Community reactions

The vulnerability was discussed in Linux kernel mailing lists and security advisories. The community acknowledged the issue as a local privilege bypass and emphasized the importance of patching. Some researchers noted that the overlapping opcode issue is a common pattern in SCSI command handling. The response from vendors was coordinated, with patches released across major distributions. The overall sentiment was that the risk is moderate but should not be ignored, especially in environments with untrusted local users.

Additional resources

Intelligence is provided for awareness and triage. Validate exposure in your own environment before prioritising remediation.

CVE-2012-4542 · Linux Kernel SG_IO ioctl Authorization Bypass via Overlapping SCSI Opcodes | CVE Intelligence | Trusteed