Summary
Prime CMS's updateSystem GraphQL mutation passes a package version value to a shell command without safely constraining it. An authenticated administrator who can supply a crafted version string may cause commands to run with the privileges of the server process.
Affected context
The issue occurs in Prime CMS's updateSystem GraphQL mutation when it constructs yarn add or npm install commands using the supplied package version string. It becomes risky when an authenticated administrator can invoke the mutation and the value reaches child_process.exec() without effective validation or safe argument handling.
Exploit preconditions
- Attack surface: The
updateSystemGraphQL mutation - Required access: An authenticated account with administrator privileges
- Trigger point: Processing an update request that includes a package version string
- Why exploitation is possible: The version value is passed to
child_process.exec()as part of a shell command, allowing shell metacharacters in the value to alter command execution.
Why this happens
The underlying issue is OS command injection, mapped to CWE-78. The application incorporates externally supplied data into a shell command without safely separating data from command syntax. Because child_process.exec() invokes a shell, untrusted metacharacters can be interpreted as part of the command rather than as literal argument content.
Potential impact
- An attacker could execute arbitrary shell commands as the server process.
- The server's files, data, or runtime configuration may be exposed or modified.
- Depending on the server's permissions and environment, the compromise could affect connected services or other systems.
General mitigation guidance
Defensive patterns focus on avoiding shell interpretation and limiting trust in user-controlled values. Prefer APIs that pass executable arguments separately without invoking a shell; constrain package versions to an expected format and validate them against an explicit policy. Where possible, use fixed, trusted package identifiers and avoid allowing request data to determine command structure. Run the application with least-privilege permissions so that any command execution has limited reach.
How teams detect issues like this
Review code paths that pass request-derived values to shell-invoking APIs, including child_process.exec(). Static analysis can flag shell execution and trace whether GraphQL inputs reach command strings. Code reviews can check that package names and versions are constrained and that data is passed as discrete arguments rather than concatenated into shell commands. Policy checks can restrict shell-based process execution and require validation for administrator-controlled update inputs.

