CVE-2026-76848
Received Received - Intake

TypeORM SelectQueryBuilder.distinctOn SQL Injection Vulnerability

Vulnerability report for CVE-2026-76848, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-24

Last updated on: 2026-08-24

Assigner: VulnCheck

Description

TypeORM's SelectQueryBuilder.distinctOn accepts an array of strings and stores it on the expression map without validation. For PostgreSQL-family drivers, createSelectDistinctExpression in src/query-builder/SelectQueryBuilder.ts joins that array and interpolates the result into the generated statement as SELECT DISTINCT ON (values), with no escaping, quoting, identifier validation or allowlist, and without routing the values through replacePropertyNames or the driver's escape helper. Because the interpolation point is a parenthesized SQL expression list rather than an identifier-only position, a supplied element may carry arbitrary expressions, including correlated subqueries. An application that forwards a client-controlled value into distinctOn, for instance to let a caller choose a deduplication column, allows that client to read data anywhere the application's database role can reach through boolean or time-based inference, independently of the entity being queried. validateOrderByCondition, the allowlist check guarding the orderBy family in the same class, is not applied to this path.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-24
Last Modified
2026-08-24
Generated
2026-08-24
AI Q&A
2026-08-24
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 2 associated CPEs
Vendor Product Version / Range
typeorm typeorm *
typeorm typeorm From 0.2.21 (inc) to 1.1.0 (inc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-89 The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

TypeORM's SelectQueryBuilder.distinctOn method accepts an array of strings without validation and directly interpolates them into SQL queries for PostgreSQL-family drivers. This allows arbitrary SQL expressions, including correlated subqueries, to be injected. The lack of escaping, quoting, or validation enables SQL injection attacks if client-controlled values are passed into distinctOn.

Detection Guidance

To detect this vulnerability, inspect TypeORM applications using SelectQueryBuilder.distinctOn with PostgreSQL-family drivers. Check if user-controlled input is passed to distinctOn without validation. Review SQL query logs for suspicious patterns like arbitrary expressions or correlated subqueries in DISTINCT ON clauses.

Impact Analysis

An attacker could exploit this to read sensitive data from anywhere the application's database role can access, using boolean or time-based inference. This could lead to unauthorized data access, data exfiltration, or manipulation of database records if user input is used in the distinctOn parameter.

Compliance Impact

This vulnerability could lead to unauthorized data access or exfiltration, violating confidentiality requirements in GDPR and HIPAA. Organizations using affected TypeORM versions may face compliance violations, legal penalties, and reputational damage due to potential data breaches.

Mitigation Strategies

Immediately upgrade TypeORM to a patched version beyond 1.1.0. If upgrading is not possible, disable the distinctOn feature or implement strict input validation to ensure only safe column names are accepted. Review all usages of SelectQueryBuilder.distinctOn for client-controlled input.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-76848. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart