/

CVE-2026-31871

Severity:

CRITICAL RISK

(9.8)

SQL Injection in Parse Server PostgreSQL Increment Handler

CVE-2026-31871

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution and Data Exposure

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Parse Server's PostgreSQL storage adapter contains a SQL injection flaw when handling Increment operations on nested object fields referenced with dot notation (for example, stats.counter).

Because the nested sub-key is interpolated directly into SQL string literals without proper escaping, an attacker who can issue write requests to the REST API may inject arbitrary SQL through crafted field names, potentially executing database commands or reading protected data.

Affected context

The vulnerability occurs in Parse Server deployments that:

  • Use PostgreSQL as the database backend
  • Support Increment operations on nested object fields via dot notation in the REST API
  • Accept client-controlled field names or sub-keys without server-side normalization or strict validation

It is relevant where external or semi-trusted clients can perform write operations against collections that include nested numeric fields, especially in multi-tenant or internet-facing deployments.

Exploit preconditions

  • Attack surface: Parse Server REST API endpoints that accept write operations (e.g., object updates) performing Increment on nested fields.
  • Required access: Ability to send authenticated or unauthenticated write requests, depending on the app's Class-Level Permissions (CLPs), Access Control Lists (ACLs), and auth configuration.
  • Trigger point: An Increment request on a nested field where the sub-key name includes crafted characters (such as single quotes) that are concatenated into SQL.
  • Why exploitation is possible: The sub-key portion of a dot-notated field name is inserted directly into SQL string literals without parameterization or proper escaping, allowing attacker-controlled SQL fragments to alter the intended query structure.

Why this happens

This issue stems from building SQL statements by concatenating user-influenced identifiers directly into query strings.

In the PostgreSQL adapter's handling of Increment operations on nested fields, the sub-key derived from dot notation (e.g., the counter portion of stats.counter) is treated as safe and interpolated into a SQL literal.

Because this value is not passed through parameterized query mechanisms or robust identifier quoting/escaping, an attacker can embed SQL syntax (such as unmatched quotes and additional clauses) into the sub-key.

This aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where attacker-controlled input changes the semantics of generated SQL.

Potential impact

  • Arbitrary SQL execution within the scope of the Parse Server PostgreSQL database user
  • Reading sensitive application data that would normally be protected by CLPs and ACLs
  • Modifying or deleting records, leading to data loss or integrity corruption
  • Bypassing application-level authorization checks enforced at the Parse Server layer
  • Pivoting to discover schema details and potentially chaining with other weaknesses for broader compromise

General mitigation guidance

Effective mitigation focuses on eliminating string-based SQL construction and enforcing strict boundary controls for identifiers:

  • Use parameterized queries or query builders for all dynamic parts of SQL statements, including identifiers where possible.
  • Where parameterization of identifiers is not supported, apply robust, well-tested identifier quoting/escaping routines, and restrict allowed characters for field and sub-key names (for example, whitelisting alphanumeric and limited punctuation).
  • Normalize and validate client-supplied field paths before they reach the persistence layer, rejecting unexpected or malformed dot-notation keys.
  • Enforce least-privilege on the PostgreSQL account used by Parse Server so that, even if injection occurs, the database user has minimal permissions.
  • Centralize the logic that maps application field names to database columns, avoiding ad hoc string concatenation in multiple code paths.

How teams detect issues like this

Detection can combine code-level analysis with runtime monitoring:

  • Static analysis: Search for concatenation of request-derived field names or dot-notation keys into SQL strings in the PostgreSQL adapter. Patterns like "... " + subKey + " ..." or template literals using untrusted identifiers are key review signals.
  • Code review: Flag any data-access logic that manually assembles SQL instead of using parameterized APIs; pay particular attention to update/increment handlers and nested field support.
  • Runtime monitoring: Enable and inspect database logs for anomalous queries containing unexpected literals, unmatched quotes, or injected clauses in column or field name positions.
  • Automated tooling: Integrate SAST tools configured with rules for CWE-89, and use CI checks that block merging when unsafe SQL construction patterns are detected.

Sources

SourceLink
github.comgithub.com/parse-community/parse-server/releases/tag/8.6.31
github.comgithub.com/parse-community/parse-server/releases/tag/9.6.0-alpha.5
github.comgithub.com/parse-community/parse-server/security/advisories/GHSA-gqpp-xgvh-9h7h

Frequently asked

questions

Yes. In typical Parse Server deployments exposed over HTTP(S), any client able to issue write requests to affected endpoints can attempt exploitation. The impact can extend to arbitrary SQL execution within the privileges of the database user.

The attacker needs the ability to send write operations (such as Increment requests) that reference nested fields via dot notation. Whether this requires authentication depends on how CLPs, ACLs, and authentication rules are configured for the targeted classes.

Replace string-concatenated SQL with parameterized queries and strict identifier handling. Ensure that any field or sub-key names derived from client input are validated against an allowed-character policy and passed through appropriate quoting mechanisms before reaching the database layer.

Adopt a project-wide rule that disallows building SQL using raw string concatenation with untrusted data, mandate use of safe query builders or ORM abstractions, and include explicit security checks for dynamic query construction in code reviews and automated analysis pipelines.

Find out what's already
exploitable in your codebase.