Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
NONE severity

GHSA-59xv-588h-2vmm @saltcorn/data

NONE

GHSA-59xv-588h-2vmm is a none-severity (CVSS 0) vulnerability in @saltcorn/data. A fix is available for @saltcorn/data — see the affected versions and patch details below.

@saltcorn/data vulnerable to SQL Injection via jsexprToSQL Literal Handler

Published
Apr 10, 2026
Updated
Apr 10, 2026
Affected
3 pkgs
Patched
3 / 3
Exploits
None indexed
Exploitation data as of Apr 10, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

3 pkgs affected

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.

138other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
@saltcorn/datanpm
645downloads / week

Description

Summary

The jsexprToSQL() function in Saltcorn converts JavaScript expressions to SQL for use in database constraints. The Literal handler wraps string values in single quotes without escaping embedded single quotes, allowing SQL injection when creating Formula-type table constraints.

Vulnerable Component

File: packages/saltcorn-data/models/expression.ts, lines 117-118

Literal({ value }: { value: ExtendedNode }) {
  if (typeof value == "string") return `'${value}'`;  // NO ESCAPING!
  return `${value}`;
},

Call chain: Formula constraint creation → table_constraints.ts:127jsexprToSQL()Literal()db.query() executes unsanitized SQL.

Proof of Concept

Injection via Formula Constraint

When an admin creates a Formula-type table constraint with the expression:

name === "test' OR '1'='1"

The jsexprToSQL() function generates:

(name)=('test' OR '1'='1')

This is then executed as:

ALTER TABLE "tablename" ADD CONSTRAINT "tablename_fml_1" CHECK ((name)=('test' OR '1'='1'));

The single quote in the string literal is not escaped, breaking out of the SQL string context.

More Dangerous Payload

name === "'; DROP TABLE users; --"

Generates:

(name)=(''; DROP TABLE users; --')

Verified on Saltcorn v1.5.0 (Docker)

Direct invocation of jsexprToSQL() inside the running container confirms the vulnerability:

Input:  name === "hello"
Output: (name)=('hello')                          ← Normal

Input:  name === "test' OR '1'='1"
Output: (name)=('test' OR '1'='1')                ← Single quote NOT escaped, OR injected

Input:  name === "'; DROP TABLE users; --"
Output: (name)=(''; DROP TABLE users; --')         ← DROP TABLE injected

The test was performed on a completely fresh Saltcorn installation (zero user-created tables, default Docker setup).

PoC Screenshot

  1. Create a table after moving to the table menu
<img width="1194" height="559" alt="SCR-20260307-edqn" src="https://github.com/user-attachments/assets/a2d11102-f49b-4b2b-88ff-fced37476b6f" />
  1. Go to the table and then to Constraits
<img width="1180" height="600" alt="SCR-20260307-edsg" src="https://github.com/user-attachments/assets/b55ddace-01be-4a53-8f62-cbec98172cd7" />
  1. Go to Formula
<img width="1130" height="518" alt="SCR-20260307-edud" src="https://github.com/user-attachments/assets/8a5addc6-e681-401b-91ea-bce3b0eece54" />
  1. Create a test table for verification
<img width="857" height="294" alt="SCR-20260307-eetw" src="https://github.com/user-attachments/assets/debc8581-8145-44cb-a684-2bc3eb7adbcf" />
  1. Input the payload and save
<img width="763" height="383" alt="SCR-20260307-ehcz" src="https://github.com/user-attachments/assets/f7a3aa34-7b0b-48ea-b1df-f852f137c37f" />
  1. Check the table for testing
<img width="549" height="256" alt="SCR-20260307-ehuh" src="https://github.com/user-attachments/assets/8f6da842-0275-4729-93bf-96575f3fe963" />

Impact

  • Arbitrary SQL execution via crafted CHECK constraints
  • Data exfiltration through error-based or time-based SQL injection
  • Database schema manipulation (DROP TABLE, ALTER TABLE)
  • Potential privilege escalation via direct users table modification

Suggested Remediation

Escape single quotes in the Literal handler:

Literal({ value }: { value: ExtendedNode }) {
  if (typeof value == "string") return `'${value.replace(/'/g, "''")}'`;
  return `${value}`;
},

Alternatively, use parameterized queries for constraint creation instead of string interpolation.

Affected Packages

3 total 3 fixed
EcosystemPackageVulnerable rangeFix
📦npm@saltcorn/dataall versions1.4.5npm install @saltcorn/data@1.4.5
📦npm@saltcorn/data1.5.0&&< 1.5.51.5.5npm install @saltcorn/data@1.5.5
📦npm@saltcorn/data1.6.0-alpha.0&&< 1.6.0-beta.41.6.0-beta.4npm install @saltcorn/data@1.6.0-beta.4

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @saltcorn/data, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update @saltcorn/data to 1.4.5 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-59xv-588h-2vmm is resolved across your whole dependency graph.

  3. 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.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-59xv-588h-2vmm can be triaged on real exposure rather than presence alone.

Tailored to GHSA-59xv-588h-2vmm. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

## Summary The `jsexprToSQL()` function in Saltcorn converts JavaScript expressions to SQL for use in database constraints. The `Literal` handler wraps string values in single quotes without escaping embedded single quotes, allowing SQL injection when creating Formula-type table constraints. ## Vulnerable Component **File:** `packages/saltcorn-data/models/expression.ts`, lines 117-118 ```typescript Literal({ value }: { value: ExtendedNode }) { if (typeof value == "string") return `'${value}'`; // NO ESCAPING! return `${value}`; }, ``` **Call chain:** Formula constraint creation → `t
O3 Security · Impact-Aware SCA

Is GHSA-59xv-588h-2vmm in your dependencies?

O3 Security finds GHSA-59xv-588h-2vmm across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-59xv-588h-2vmm: None 0 severity | O3 Security