/

CVE-2026-33539

Severity:

HIGH RISK

(7.2)

SQL Injection in Parse Server PostgreSQL Backends

CVE-2026-33539

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database-Level Remote Code / Command Execution via SQL and Privilege Escalation

Severity:

HIGH RISK

(7.2)

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 deployments using PostgreSQL are vulnerable to SQL injection when attacker-controlled field name parameters are used in the aggregate $group pipeline stage or the distinct operation.

An attacker who already possesses the Parse Server master key can inject SQL metacharacters into these parameters to execute arbitrary SQL statements against the PostgreSQL database, potentially escalating from application-level administrative access to full database-level control.

Affected context

The vulnerability occurs in Parse Server instances configured to use PostgreSQL as the data store, where the backend constructs SQL queries from high-level operations such as aggregate $group and distinct.

In affected versions, field name parameters provided to these operations may be incorporated into SQL statements without robust sanitization or identifier handling.

This becomes risky when the caller has access to the master key, which bypasses many normal access controls and allows powerful aggregate and distinct queries to be executed against arbitrary classes.

Exploit preconditions

  • Attack surface: Parse Server API endpoints that support:
  • Aggregate operations using the $group pipeline stage
  • The distinct operation on classes (tables)
  • Required access: Knowledge and possession of the Parse Server master key (application-level administrative credential).
  • Trigger point: Submission of requests that specify crafted field name parameters for $group or distinct such that they are embedded into generated SQL.
  • Why exploitation is possible: The server-side query builder treats field names as trusted identifiers and interpolates them into SQL without consistently enforcing strict identifier validation or safe parameterization, enabling SQL metacharacters in field names to alter the structure of the executed SQL statement.

Why this happens

This vulnerability is a classic case of CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), but occurring in the context of field names rather than typical data values.

The query-building logic for PostgreSQL translates high-level Parse Server operations like $group and distinct into SQL by concatenating or formatting field names directly into the query string.

Because field name parameters reachable via master key operations are not sufficiently validated or escaped as identifiers, an attacker can supply field names containing SQL metacharacters that break out of the intended identifier context.

This transforms what should be static SQL structure into partially attacker-controlled logic, allowing injection of arbitrary SQL fragments and unintended database commands.

Potential impact

  • Execution of arbitrary SQL statements on the PostgreSQL database.
  • Escalation from Parse Server application-level administrative access to full database administrative capabilities.
  • Unauthorized reading of sensitive data from any table the database user can access.
  • Unauthorized modification or deletion of application data, including data integrity compromise.
  • Creation or modification of database roles, permissions, or schema objects, where permitted by the database user's privileges.
  • Potential lateral movement to other applications or services that share the same database or credentials.

General mitigation guidance

Effective mitigation focuses on treating all externally influenced query components, including field names and identifiers, as untrusted input and constraining them aggressively:

  • Use strict allowlists for field names and aggregation keys, resolving client-supplied identifiers to a predefined set of columns rather than accepting arbitrary names.
  • Separate query structure from input completely: do not interpolate field names into SQL strings based on raw client parameters.
  • When dynamic identifiers are unavoidable, normalize and validate them against schema metadata and apply safe identifier-quoting utilities provided by the database driver or ORM.
  • Reduce the power of the application's database account by following least-privilege principles, limiting its ability to perform dangerous operations like DDL or role changes.
  • Treat master key operations as highly sensitive: restrict who or what can use the master key, rotate it regularly, and avoid exposing it broadly in infrastructure or code.
  • Implement defense-in-depth controls such as database-level query policies, read-only roles for typical operations, and separation between administrative and application accounts.

How teams detect issues like this

Detection typically combines code-level analysis with runtime monitoring:

  • Static analysis and code review:
  • Search for query construction paths where field names or other identifiers originate from client parameters or master key operations and are interpolated into SQL without allowlisting or identifier escaping.
  • Flag custom query builders or ORM wrappers that manually concatenate SQL fragments, especially around aggregate and distinct operations.
  • Review master-key-only code paths for assumptions that master key implies trusted input, and ensure they still enforce validation on identifiers.
  • Runtime monitoring:
  • Enable database logging of all SQL statements and review for anomalous patterns, such as injected comment characters, stacked queries, or unexpected DDL commands originating from the Parse Server application user.
  • Use database intrusion detection or anomaly detection tools to alert on suspicious SQL constructs and privilege changes.
  • Policy and tooling:
  • Integrate security linters or SAST tools that are tuned to detect dynamic SQL construction using identifier parameters.
  • Enforce code review guidelines that require explicit validation and allowlisting for any user- or configuration-sourced identifiers in queries.

Sources

SourceLink
github.comgithub.com/parse-community/parse-server/commit/03249f9bf5b8783c8b848f84dab791ff0b761b8c
github.comgithub.com/parse-community/parse-server/commit/bdddab5f8b61a40cb8fc62dd895887bdd2f3838e
github.comgithub.com/parse-community/parse-server/pull/10272
github.comgithub.com/parse-community/parse-server/pull/10273
github.comgithub.com/parse-community/parse-server/security/advisories/GHSA-p2w6-rmh7-w8q3

Frequently asked

questions

It can be remotely exploitable if an attacker can send requests to the Parse Server API and possesses the master key, since they can craft aggregate $group or distinct operations that reach the vulnerable query construction paths.

The attacker must have access to the Parse Server master key or equivalent administrative capability that allows issuing privileged aggregate and distinct queries. Without the master key, typical clients should not be able to reach the vulnerable behavior.

The safest pattern is to avoid building SQL from raw client-controlled identifiers entirely, instead mapping requested fields to a predefined, server-side allowlist and using query-building utilities that treat identifiers and values separately with proper escaping. Additionally, restrict the database account's privileges so that, even if a query is compromised, its impact is limited.

Treat every query component, including field names, table names, and operators, as untrusted unless sourced from immutable server-side definitions. Enforce strict validation and allowlisting, adopt parameterized and structured query-building APIs, limit the power of administrative keys, and include focused security review for any feature that introduces dynamic query generation or master-key-only operations.

Find out what's already
exploitable in your codebase.