Vulnerability DatabaseGHSA-4rq7-f537-x35q

GHSA-4rq7-f537-x35q: 
JavaScript vulnerability analysis and mitigation

Summary

On Windows the module calls chcp while it is being loaded, and it calls it by name only. That goes through cmd.exe, and cmd.exe looks in the current directory before it looks in PATH. So if node was started in a folder that happens to contain a chcp.cmd (or .bat, .exe, .com), that file is executed instead of the real C:\Windows\System32\chcp.com. You don't have to call any function for this. require('systeminformation') is enough.

Details

lib/index.js line 56:

if (_windows) {
  util.getCodepage();
  util.getPowershell();
}

lib/util.js line 575:

function getCodepage() {
  if (_windows) {
    if (!codepage) {
      try {
        const stdout = execSync('chcp', execOptsWin);

execSync ends up as cmd.exe /d /s /c "chcp". Unless the env var NoDefaultCurrentDirectoryInExePath exists (it doesn't on a normal Windows install), cmd tries the current directory first with every PATHEXT extension, and only then PATH. Microsoft documents the variable here: https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-needcurrentdirectoryforexepathw The file can be a plain text .cmd, the attacker doesn't need to drop a binary. There are more calls like this. They are less interesting because the app has to call the function first, but they have the same problem:

  • lib/network.js:70 netstat -r (networkInterfaces, networkInterfaceDefault, networkStats with no iface)
  • lib/network.js:298 ipconfig /all (networkInterfaces)
  • lib/network.js:362 netsh lan show profiles (networkInterfaces)
  • lib/network.js:375 and :427 execFileSync('netsh', ...) (networkInterfaces, wifi adapters)
  • lib/network.js:1792 netstat -nao (networkConnections)
  • lib/network.js:1975 netstat -r (networkGatewayDefault)
  • lib/util.js:614 WHERE smartctl and lib/filesystem.js:1811 smartctl (diskLayout) I ran the chcp, netstat, netsh lan and ipconfig ones and they all picked up my file. The two execFileSync('netsh') calls don't use cmd.exe, but node on Windows also checks the cwd first for a bare name, at least for .exe: I copied whoami.exe to .\netsh.exe and execFileSync('netsh', [...]) ran my copy. The smartctl ones I only read, I don't have smartmontools installed.

powershell.exe and reg.exe are already called with a full path (util.js:357, osinfo.js:1297), so I assume the others were just never changed. Line numbers are from 5.33.22. master has the same code right now.

Proof of concept

Windows 10 Pro 19045, node v26.13.0, systeminformation 5.33.22 from npm. Run in PowerShell.


# some app that only loads the module
mkdir C:\poc\app; cd C:\poc\app
npm init -y; npm install systeminformation@5.33.22
"const si = require('systeminformation'); console.log('required', si.version());" | Out-File -Encoding ascii app.js

# folder with one file from the attacker
mkdir C:\poc\untrusted; cd C:\poc\untrusted
"@echo off`r`necho executed %~nx0 as %USERNAME%> `"%~dp0EXECUTED.txt`"`r`necho Active code page: 437" | Out-File -Encoding ascii chcp.cmd

# empty folder for comparison
mkdir C:\poc\clean; cd C:\poc\clean
node C:\poc\app\app.js
dir

# same app, started from the other folder
cd C:\poc\untrusted
node C:\poc\app\app.js
dir
type EXECUTED.txt

What I get:

---- cwd = clean
required 5.33.22
files now:
---- cwd = untrusted
required 5.33.22
files now: chcp.cmd, EXECUTED.txt
EXECUTED.txt: executed chcp.cmd as <my user>

(that's the output of my script, which does the steps above and prints the folder contents after each run) The app prints the same thing both times, so the user has no idea something else ran. One thing that cost me some time: my first terminal had NoDefaultCurrentDirectoryInExePath set and nothing happened. If it doesn't reproduce for you, check echo %NoDefaultCurrentDirectoryInExePath% and unset it. It is not set on a default system. With netsh.cmd, netstat.cmd and ipconfig.cmd in the folder too, and the app calling networkInterfaces(), networkGatewayDefault() and networkConnections(), the log looks like this:

executed chcp.cmd     args=[]
executed netstat.cmd  args=[-r]
executed netsh.cmd    args=[lan show profiles]
executed ipconfig.cmd args=[/all]
executed netstat.cmd  args=[-r]
executed netstat.cmd  args=[-nao]

I can send the two scripts I used if that helps.

Impact

Code execution as the user running node. The realistic case is somebody running a CLI or an Electron/desktop app that depends on systeminformation from inside a folder they didn't create themselves: a cloned repo, an unpacked zip, a network share. The file runs at module load, before the app has done anything. It could also be a local privilege escalation if something running as a higher privileged account loads the module with a working directory that normal users can write to. I haven't looked for a concrete case of that, so I'm not claiming it. I know the cwd lookup is a Windows thing and not something this library invented. I'm still reporting it here because it happens inside require(), so an app using the library can't do anything about it, and because it's a small change on your side. Yarn got CVE-2021-4435 for the same kind of bug with the same CVSS vector.


Source: NVD

Related JavaScript vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-vqxq-2wvm-wwq5MEDIUM6.1
  • JavaScript logoJavaScript
  • unhead
NoYesNov 23, 2026
GHSA-cw38-r4mr-qh2vMEDIUM6.1
  • JavaScript logoJavaScript
  • unhead
NoYesNov 23, 2026
GHSA-hx39-7p87-p6mvMEDIUM4.7
  • JavaScript logoJavaScript
  • unhead
NoYesNov 23, 2026
GHSA-43vv-qp67-mww8MEDIUM4.7
  • JavaScript logoJavaScript
  • unhead
NoYesNov 23, 2026
GHSA-6r92-h7v8-c87rLOW2
  • JavaScript logoJavaScript
  • unhead
NoYesNov 23, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management