CVE-2022-21810: Command injection in smartctl
7.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.47745%
CWE
Published
1/26/2023
Updated
2/2/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
smartctl | npm | <= 1.0.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability manifests in the info
method which takes a devicePath
parameter and passes it unsanitized to execSmart
. The code shows direct concatenation of user input into a shell command ("smartctl -i " + devicePath
) using exec()
. This pattern is vulnerable to command injection as confirmed by: 1) The advisory explicitly naming the info
method 2) The Snyk PoC demonstrating injection via this parameter 3) The visible lack of input sanitization or safe execution methods (like execFile
with separated arguments) in the code. The execSmart
function is a common helper that amplifies this vulnerability across multiple entry points.