VYPR
Unrated severityNVD Advisory· Published Oct 11, 2021· Updated Aug 4, 2024

CVE-2021-42257

CVE-2021-42257

Description

check_smart before 6.9.1 allows unintended drive access by an unprivileged user because it only checks for a substring match of a device path (the /dev/bus substring and a number), aka an unanchored regular expression.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Unanchored regex in check_smart.pl before 6.9.1 allows unprivileged users to execute smartctl on arbitrary drives, leading to privilege escalation and drive manipulation.

Vulnerability

The check_smart.pl monitoring plugin, versions 6.1 through 6.9, contains a vulnerability in its device path validation. The plugin uses an unanchored regular expression to verify that a device path contains the substring /dev/bus followed by a number. This regex can be bypassed by crafting a path that includes the substring but points to an unintended device, allowing arbitrary drive access. The plugin runs with root privileges via sudo. [1][2][3]

Exploitation

An unprivileged user with permission to execute check_smart.pl (e.g., the monitoring system user) can supply a crafted device path that matches the weak regex, such as /dev/bus/0 or any path containing the substring. The plugin then executes smartctl on that device, which may be a different drive than intended. The attacker can exploit this to issue SMART commands, including modifying settings or disabling monitoring. [3][4]

Impact

Successful exploitation allows an unprivileged attacker to modify SMART settings, disable SMART monitoring entirely, shut down a hard drive, or degrade drive performance by disabling the read cache. This constitutes a privilege escalation from an unprivileged user to root-level drive manipulation, potentially causing denial of service or data integrity issues. [3][4]

Mitigation

The vulnerability is fixed in version 6.9.1, released on October 14, 2021 [3]. All users should upgrade immediately. No workarounds are documented; ensure the plugin is patched or restrict access to the plugin until the upgrade is applied.

AI Insight generated on May 27, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

2

Patches

0

No patches discovered yet.

Vulnerability mechanics

Root cause

"Unanchored regular expression in device path validation allows substring matching of "/dev/bus" plus a digit, enabling path traversal bypass."

Attack vector

An unprivileged user who can invoke check_smart.pl (e.g., via a Nagios check command) supplies a crafted device path via the -d or --device parameter. The plugin's regex only checks for the substring "/dev/bus" followed by a number, so a path like "/dev/sda/../../dev/bus/0" matches the pattern and is treated as a pseudo-device. This allows the attacker to access arbitrary block devices that the plugin would otherwise restrict, potentially reading sensitive drive data or triggering smartctl operations on unintended drives [ref_id=1].

Affected code

The vulnerability resides in the device path validation logic of check_smart.pl. The plugin uses an unanchored regular expression to check whether a user-supplied device path is a pseudo-device of the form /dev/bus/N. Because the regex only looks for the substring "/dev/bus" followed by a digit anywhere in the path, an attacker can supply a path such as "/dev/sda/../../dev/bus/0" and bypass the intended restriction [ref_id=1].

What the fix does

The advisory states that version 6.9.1 fixes the regex for pseudo-devices [ref_id=1]. The fix anchors the regular expression so that it matches the device path from the beginning, preventing substring matches. This ensures that only paths that actually start with "/dev/bus" followed by a number are recognized as pseudo-devices, blocking path traversal or other crafted strings that merely contain that substring.

Preconditions

  • inputThe attacker must be able to pass a crafted device path to the -d or --device parameter of check_smart.pl
  • configThe plugin must be running with sufficient privileges (typically root via sudo) to access the target block device

Generated on May 25, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.