Summary
@saltcorn/plugins-loader unsanitized plugin name leads to a remote code execution (RCE) vulnerability when creating plugins using git source
When creating a new plugin using the git source, the user-controlled value req.body.name is used to build the plugin directory where the location will be cloned. The API used to execute the git clone command with the user-controlled data is child_process.execSync. Since the user-controlled data is not validated, a user with admin permission can add escaping characters and execute arbitrary commands, leading to a command injection vulnerability.
Details
Relevant code from source (req.body) to sink (child_process.execSync).
- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/server/routes/plugins.js#L1400
router.post(
"/",
isAdmin,
error_catcher(async (req, res) => {
const plugin = new Plugin(req.body); // [1]
[...]
try {
await load_plugins.loadAndSaveNewPlugin( // [3]
plugin,
schema === db.connectObj.default_schema || plugin.source === "github"
);
[...]
}
})
);
- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/saltcorn-data/models/plugin.ts#L44
class Plugin {
[...]
constructor(o: PluginCfg | PluginPack | Plugin) {
[...]
this.name = o.name; // [2]
[...]
}
- file: https://github.com/saltcorn/saltcorn/blob/v1.0.0-beta.13/packages/server/load_plugins.js#L64-L65
const loadAndSaveNewPlugin = async (plugin, force, noSignalOrDB) => {
[...]
const loader = new PluginInstaller(plugin); // [4]
const res = await loader.install(force); // [7]
[...]
};
class PluginInstaller {
constructor(plugin, opts = {}) {
[...]
const tokens =
plugin.source === "npm"
? plugin.location.split("/")
: plugin.name.split("/"); // [5]
[...]
this.tempDir = join(this.tempRootFolder, "temp_install", ...tokens); // [6]
[...]
}
async install(force) {
[...]
if (await this.prepPluginsFolder(force, pckJSON)) { // [8]
[...]
}
async prepPluginsFolder(force, pckJSON) {
[...]
switch (this.plugin.source) {
[...]
case "git":
if (force || !(await pathExists(this.pluginDir))) {
await gitPullOrClone(this.plugin, this.tempDir); // [9]
[...]
}
const gitPullOrClone = async (plugin, pluginDir) => {
[...]
if (fs.existsSync(pluginDir)) {
execSync(`git ${setKey} -C ${pluginDir} pull`);
} else {
execSync(`git ${setKey} clone ${plugin.location} ${pluginDir}`); // [10]
}
[...]
};
PoC
- check that the file will be created by the command
echo "hello">/tmp/HACKEDdoes not exists:
cat /tmp/HACKED
cat: /tmp/HACKED: No such file or directory
- login with an admin account
- visit
http://localhost:3000/plugins/new - enter the following fields:
- Name:
;echo "hello">/tmp/HACKED - Source:
git - other fields blank
- Name:
- click
Create - you will get an error saying
ENOENT: no such file or directory, ....but the commandtouch /tmp/HACKEDwill be executed - to verify:
cat /tmp/HACKED
hello
Remote code execution
Recommended Mitigation
Sanitize the pluginDir value before passing to execSync. Alternatively, use child_process. execFileSync API (docs: https://nodejs.org/api/child_process.html#child_processexecfilesyncfile-args-options)
Impact
Untrusted input reaches a shell command, allowing arbitrary commands to run on the host. Typical impact: code execution in the application's environment.
GHSA-FM76-W8JW-XF8M has a CVSS score of 7.2 (High). The vector is network-reachable, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.0.0-beta.14); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-FM76-W8JW-XF8M? GHSA-FM76-W8JW-XF8M is a high-severity OS command injection vulnerability in @saltcorn/plugins-loader (npm), affecting versions <= 1.0.0-beta.13. It is fixed in 1.0.0-beta.14. Untrusted input reaches a shell command, allowing arbitrary commands to run on the host.
- How severe is GHSA-FM76-W8JW-XF8M? GHSA-FM76-W8JW-XF8M has a CVSS score of 7.2 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of @saltcorn/plugins-loader are affected by GHSA-FM76-W8JW-XF8M? @saltcorn/plugins-loader (npm) versions <= 1.0.0-beta.13 is affected.
- Is there a fix for GHSA-FM76-W8JW-XF8M? Yes. GHSA-FM76-W8JW-XF8M is fixed in 1.0.0-beta.14. Upgrade to this version or later.
- Is GHSA-FM76-W8JW-XF8M exploitable, and should I be worried? Whether GHSA-FM76-W8JW-XF8M is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-FM76-W8JW-XF8M is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-FM76-W8JW-XF8M? Upgrade
@saltcorn/plugins-loaderto 1.0.0-beta.14 or later.