# CVE-2026-40906: ElectricSQL SQL injection in /v1/shape API order_by parameter

Source: https://junglewise.ai/threats/cve-2026-40906-electricsql-sql-injection-in-v1-shape-api-order-by-parameter  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-04-21. Updated: 2026-06-30  
License: CC BY 4.0 with a link back

CVE-2026-40906 · Severity: critical · CVSS 9.9 · Published 2026-04-21

Electric is a synchronization engine that connects PostgreSQL databases to local applications. A security flaw in its API allows any logged-in user to execute unauthorized database commands by sending a specially crafted request. This could allow an attacker to read sensitive customer data, modify or delete records, and potentially take full control of the underlying database server.

Technologies: [Red Hat Developer Hub](https://junglewise.ai/threats/technologies/developer-hub). Vendors: [Red Hat](https://junglewise.ai/threats/vendors/red-hat).

## Quick answers

**Is CVE-2026-40906 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40906 being exploited in the wild.

**How severe is CVE-2026-40906?** Critical severity, with a CVSS score of 9.9, published 21 April 2026.

**Which products and versions are affected?** ElectricSQL Electric >= 1.1.12, < 1.5.0; ElectricSQL Electric sync-service 1.1.12 to 1.4.x; Red Hat Developer Hub 1.

**Is there a fix for CVE-2026-40906?** A patch was published on 2026-04-02: Version 1.5.0 released and deployed to Cloud instances Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-40906 attacked?** It is attacked over the network, in a hosted service.

**Am I affected by CVE-2026-40906?** Check whether you run Electric Sync-Service, ElectricSQL Electric, ElectricSQL Electric sync-service or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

An error-based SQL injection vulnerability exists in the ElectricSQL sync-service due to improper validation of the 'order_by' parameter in the /v1/shape API. The 'Parser.validate_order_by' function utilized a permissive wildcard catch-all in its AST walker, allowing arbitrary SQL expressions (such as SubLink, FuncCall, and TypeCast) to be concatenated directly into the final PostgreSQL query. Attackers can leverage this to extract data via error messages (e.g., using CAST), execute arbitrary DML/DDL via 'dblink_exec', or cause a denial of service. The vulnerability is fixed in version 1.5.0 by implementing a deny-by-default allowlist for AST nodes and rebuilding the SQL clause from the validated AST using 'PgQuery.protobuf_to_query/1'.

## Affected products

- ElectricSQL Electric >= 1.1.12, < 1.5.0
- Red Hat Red Hat Developer Hub 1

## Timeline

- 2025-10-02: other: Vulnerable code introduced in version 1.1.12
- 2026-04-02: disclosed: Vulnerability reported by Casco
- 2026-04-02: patched: Version 1.5.0 released and deployed to Cloud instances
- 2026-04-21: advisory: CVE-2026-40906 published

## References

- [https://github.com/electric-sql/electric/pull/4081](https://github.com/electric-sql/electric/pull/4081)
- [https://github.com/electric-sql/electric/security/advisories/GHSA-h5rg-pxx7-r2hj](https://github.com/electric-sql/electric/security/advisories/GHSA-h5rg-pxx7-r2hj)
- [https://access.redhat.com/security/cve/CVE-2026-40906](https://access.redhat.com/security/cve/CVE-2026-40906)
- [https://bugzilla.redhat.com/show_bug.cgi?id=2460291](https://bugzilla.redhat.com/show_bug.cgi?id=2460291)
- [https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40906.json](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40906.json)

## Related threats

- [ElectricSQL Electric Postgres Sync information disclosure via subset where clauses](https://junglewise.ai/threats/cve-2026-65314-electricsql-electric-postgres-sync-information-disclosure-via)
- [patriksimek vm2 remote code execution via NodeVM allowlist bypass](https://junglewise.ai/threats/cve-2026-43999-patriksimek-vm2-remote-code-execution-via-nodevm-allowlist-bypass)
- [patriksimek vm2 remote code execution via symlink traversal in NodeVM](https://junglewise.ai/threats/cve-2026-43998-patriksimek-vm2-remote-code-execution-via-symlink-traversal-in)
- [protobufjs code injection in toObject function generation](https://junglewise.ai/threats/cve-2026-44293-protobufjs-code-injection-in-toobject-function-generation)
- [Fastify fast-uri host confusion via percent-encoded authority delimiters](https://junglewise.ai/threats/cve-2026-6322-fastify-fast-uri-host-confusion-via-percent-encoded-authority)
