CVE-2026-42853: @apostrophecms/cli Command Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-hcwq-x9fw-8cfq
CVSS 6.5
CWE-78
Published
Advisory Summary

CVE-2026-42853 is a MODERATE (CVSS 6.5) command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting @apostrophecms/cli libraries in the npm ecosystem. The issue involves command injection in apos create via unsanitized password input. Remediation is available in the latest vendor maintenance releases.

CVE-2026-42853 at a Glance

CVE Identifier CVE-2026-42853
GHSA Identifier GHSA-hcwq-x9fw-8cfq
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product @apostrophecms/cli
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-42853

To remediate this vulnerability, upgrade all affected @apostrophecms/cli dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@apostrophecms/cli fixed: Latest secure release
npm install @apostrophecms/cli@Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @apostrophecms/cli

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-42853, inspect your project dependencies using npm:

npm ls @apostrophecms/cli

Analyze the terminal output to locate any version of @apostrophecms/cli in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls @apostrophecms/cli command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In @apostrophecms/cli, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Summary The @apostrophecms/cli package contains a command injection vulnerability in the apos create command. User-supplied input from the password prompt is embedded directly into a shell command without proper sanitization or escaping. This allows execution of arbitrary commands on the host system. ━━━━━━━━━━━━━━━━━━━━━━ Details Vulnerable file: lib/commands/create.js Location: Line 186 The CLI collects a password using an interactive prompt and passes it directly into a shell command. Vulnerable code: const response = await prompts({ type: 'password', name: 'pw', message: '🔏 Please enter a password:' }); exec(echo "${response.pw}" | ${createUserCommand}); The value of response.pw is not validated, sanitized, or escaped before being used in exec(). This allows shell metacharacters such as ;, &&, and $() to break out of the intended command and execute arbitrary commands. ━━━━━━━━━━━━━━━━━━━━━━ Steps to Reproduce 1) Install the CLI npm install -g @apostrophecms/cli 2) Create a new project mkdir testproject && cd testproject apos create mysite 3)When prompted for the admin password, enter "; id > /tmp/apos_rce_proof.txt; echo " 4)Verify command execution cat /tmp/apos_rce_proof.txt ━━━━━━━━━━━━━━━━━━━━━━ Proof of Concept Output uid=1000(vboxuser) gid=1000(vboxuser) groups=1000(vboxuser),27(sudo),984(docker) This confirms arbitrary command execution with the privileges of the user running the CLI. ━━━━━━━━━━━━━━━━━━━━━━ Impact Arbitrary command execution on the developer’s machine Execution occurs with the privileges of the user running the CLI This can lead to: File modification or deletion Credential exposure System compromise depending on user privileges An attacker can exploit this by influencing the password input (for example, through social engineering, malicious documentation, or compromised automation scripts). The proof-of-concept shows execution under a user belonging to privileged groups such as sudo and docker, which may allow further privilege escalation depending on system configuration. ━━━━━━━━━━━━━━━━━━━━━━ Suggested Fix Avoid using exec() with user-controlled input. Use execFile() instead: const { execFileSync } = require('child_process'); execFileSync('node', [appJsPath, userTask, 'admin', 'admin'], { input: response.pw + '\n' }); ━━━━━━━━━━━━━━━━━━━━━━ Affected Version All current versions of @apostrophecms/cli ━━━━━━━━━━━━━━━━━━━━━━ Tested On Ubuntu 22.04 Node.js v18.19.1 ━━━━━━━━━━━━━━━━━━━━━━ CWE CWE-78 — Improper Neutralization of Special Elements used in an OS Command ━━━━━━━━━━━━━━━━━━━━━━

CVE-2026-42853 Affected @apostrophecms/cli Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
@apostrophecms/cli
npm
≤ 3.6.0

References

Frequently Asked Questions

What is CVE-2026-42853?
CVE-2026-42853 is a security vulnerability in @apostrophecms/cli involving Command Injection in apos create via Unsanitized Password Input under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which @apostrophecms/cli versions are affected?
Affected versions include releases prior to current release patches across affected packages: @apostrophecms/cli.
What version fixes CVE-2026-42853?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is @apostrophecms/cli affected?
Yes, @apostrophecms/cli is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-42853?
CVE-2026-42853 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-42853?
CVE-2026-42853 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-42853?
Run the dependency tree command: 'npm ls @apostrophecms/cli'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hcwq-x9fw-8cfq",
  "modified" : "2026-06-12T22:01:56Z",
  "published" : "2026-05-14T16:16:16Z",
  "aliases" : [ "CVE-2026-42853" ],
  "summary" : "@apostrophecms/cli: Command Injection in apos create via Unsanitized Password Input",
  "details" : "Summary\n\nThe @apostrophecms/cli package contains a command injection vulnerability in the apos create command.\nUser-supplied input from the password prompt is embedded directly into a shell command without proper sanitization or escaping.\nThis allows execution of arbitrary commands on the host system.\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nDetails\n\nVulnerable file: lib/commands/create.js\nLocation: Line 186\n\nThe CLI collects a password using an interactive prompt and passes it directly into a shell command.\n\nVulnerable code:\n\nconst response = await prompts({\ntype: 'password',\nname: 'pw',\nmessage: '🔏 Please enter a password:'\n});\n\nexec(echo \"${response.pw}\" | ${createUserCommand});\n\nThe value of response.pw is not validated, sanitized, or escaped before being used in exec().\n\nThis allows shell metacharacters such as ;, &&, and $() to break out of the intended command and execute arbitrary commands.\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nSteps to Reproduce\n\n1) Install the CLI\n      npm install -g @apostrophecms/cli\n2) Create a new project\n      mkdir testproject && cd testproject\n      apos create mysite\n3)When prompted for the admin password, enter\n      \"; id > /tmp/apos_rce_proof.txt; echo \"\n4)Verify command execution\n        cat /tmp/apos_rce_proof.txt\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nProof of Concept Output\n\nuid=1000(vboxuser) gid=1000(vboxuser) groups=1000(vboxuser),27(sudo),984(docker)\n\nThis confirms arbitrary command execution with the privileges of the user running the CLI.\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nImpact\n\nArbitrary command execution on the developer’s machine\nExecution occurs with the privileges of the user running the CLI\n\nThis can lead to:\n\nFile modification or deletion\nCredential exposure\nSystem compromise depending on user privileges\n\nAn attacker can exploit this by influencing the password input (for example, through social engineering, malicious documentation, or compromised automation scripts).\n\nThe proof-of-concept shows execution under a user belonging to privileged groups such as sudo and docker, which may allow further privilege escalation depending on system configuration.\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nSuggested Fix\n\nAvoid using exec() with user-controlled input.\n\nUse execFile() instead:\n\nconst { execFileSync } = require('child_process');\n\nexecFileSync('node', [appJsPath, userTask, 'admin', 'admin'], {\ninput: response.pw + '\\n'\n});\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nAffected Version\n\nAll current versions of @apostrophecms/cli\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nTested On\n\nUbuntu 22.04\nNode.js v18.19.1\n\n━━━━━━━━━━━━━━━━━━━━━━\n\nCWE\n\nCWE-78 — Improper Neutralization of Special Elements used in an OS Command\n\n━━━━━━━━━━━━━━━━━━━━━━",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@apostrophecms/cli"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "3.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/apostrophecms/apostrophe/security/advisories/GHSA-hcwq-x9fw-8cfq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42853"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apostrophecms/apostrophe"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-14T16:16:16Z",
    "nvd_published_at" : "2026-06-12T21:16:21Z"
  }
}