@saltcorn/server
Affected
- introduced
0, fixed1.4.6(semver)
Fixed versions
1.4.6
Fix
- Fixed version
1.4.6npm install @saltcorn/[email protected]
Advisory
Also known as: CVE-2026-41478
Saltcorn: SQL Injection via Unparameterized Sync Endpoints (maxLoadedId)
Summary
A critical SQL injection vulnerability in Saltcorn’s mobile-sync routes allows any authenticated low-privilege user with read access to at least one table to inject arbitrary SQL through sync parameters. This can lead to full database exfiltration, including admin password hashes and configuration secrets, and may also enable database modification or destruction depending on the backend.
Details
The issue affects the mobile-sync endpoints:
POST /sync/load_changesPOST /sync/deletesAccording to the provided analysis, user-controlled values from the request body are interpolated directly into SQL template literals without parameterization, type enforcement, or sanitization. In particular, req.body.syncInfos[tableName].maxLoadedId is embedded into SQL in getSyncRows() and timestamp-derived values are similarly interpolated in getDelRows().
Relevant vulnerable code paths include:
packages/server/routes/sync.js — getSyncRows()where data_tbl."${db.sqlsanitize(pkName)}" > ${syncInfo.maxLoadedId}and info_tbl.ref > ${syncInfo.maxLoadedId}packages/server/routes/sync.js — getDelRows()packages/server/routes/sync.js — /load_changes route handlerThe root cause is that values are treated as trusted SQL fragments rather than bound parameters. While db.sqlsanitize() is used for identifiers elsewhere, that does not protect interpolated values and is not intended to prevent value-based SQL injection. The report notes there is no parseInt(), numeric validation, or prepared-statement binding before these values are concatenated into the query string.
This means a normal authenticated user can escape the intended query logic and execute arbitrary SQL in the context of the application database. The provided evidence demonstrates successful extraction of user records and schema information through the vulnerable sync route, confirming that the injection is practically exploitable.
PoC
Based on the provided report, the issue can be reproduced by authenticating as a normal user, sending a crafted request to the affected sync endpoint, and placing a malicious SQL expression into the sync metadata field that is later interpolated into the backend query. Successful exploitation returns attacker-selected database contents in the sync response.
Impact
Critical Basis: The source's own band: CRITICAL
0, fixed 1.4.6 (semver)1.4.6
1.4.6npm install @saltcorn/[email protected]1.5.0-beta.0, fixed 1.5.6 (semver)1.5.6
1.5.6npm install @saltcorn/[email protected]1.6.0-alpha.0, fixed 1.6.0-beta.5 (semver)1.6.0-beta.5
1.6.0-beta.5npm install @saltcorn/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0