CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-9GGV-8W38-R7PM

GHSA-9GGV-8W38-R7PM: SQL Injection in TypeORM UpdateQueryBuilder and SoftDeleteQueryBuilder

Amit Schendel
Amit Schendel
Senior Security Researcher

Jun 19, 2026·6 min read·11 visits

Executive Summary (TL;DR)

TypeORM's UpdateQueryBuilder and SoftDeleteQueryBuilder allowed SQL injection via the orderBy direction parameter when targeting MySQL or MariaDB. An initial fix was bypassed via string-based API signatures, but the vulnerability is fully mitigated in the latest releases.

A critical SQL injection vulnerability was discovered in TypeORM's UpdateQueryBuilder and SoftDeleteQueryBuilder when targeting MySQL and MariaDB backends. The flaw allows unauthenticated remote attackers to execute arbitrary SQL commands because input validation was bypassed on certain method signatures. The initial patch was incomplete, leaving a bypass open, which was resolved in the final security update.

Vulnerability Overview

TypeORM is an Object-Relational Mapper (ORM) widely integrated into enterprise Node.js ecosystems to model database entities and execute queries safely. Within TypeORM, the UpdateQueryBuilder and SoftDeleteQueryBuilder components translate programmatic JavaScript or TypeScript API calls into compiled database updates. These query builders expose critical methods, including orderBy and addOrderBy, designed to let developers specify the order in which rows should be processed.

In standard relational databases, sorting rows during write-based events is highly restricted. However, the MySQL and MariaDB engines explicitly support ORDER BY syntax inside standard UPDATE and DELETE commands. This capability means that TypeORM must generate target SQL statements containing ordering instructions when running on top of MySQL or MariaDB backends.

This architectural detail exposes a significant vulnerability surface area if user input is allowed to reach the sorting direction parameter. Without rigorous validation, arbitrary characters injected into this parameter pass through the query compiler directly to the database. This failure leads to unauthenticated SQL injection, exposing relational schemas and application data to exploitation.

Root Cause Analysis

The root cause of this vulnerability lies in the inconsistent validation architecture across TypeORM query builder subclasses. While the SelectQueryBuilder implemented early syntactic validations, the builders responsible for database writes did not possess matching safeguards. Specifically, UpdateQueryBuilder and SoftDeleteQueryBuilder permitted raw string parameters to pass directly to compilation routines.

When a developer invokes the orderBy() method with string arguments, the query builder stores these options inside the query expression map. During compilation, the builder invokes the internal method createOrderByExpression(). This method reads from the expression map and directly concatenates the raw value string into the final query string template.

In an initial attempt to mitigate this issue (implemented in PR #12217), developers introduced the centralized validation helper validateOrderByCondition(). However, this fix contained a fatal design flaw: it only checked the input parameters if the root argument was structured as an object. When a developer invoked the string signature—such as orderBy(columnName, orderDirection)—the validation logic was entirely bypassed, writing the raw direction input straight to the expression map.

Code Analysis & Validation Bypass

To trace the flaw, we can analyze the control flow and structural design of the vulnerable paths. The diagram below illustrates how string-based arguments bypass the validation routine introduced in the partial patch.

The vulnerable TypeScript code within UpdateQueryBuilder.ts before the final patch illustrates this critical architectural blind spot:

// Vulnerable code in UpdateQueryBuilder.ts
orderBy(
    sort?: string | OrderByCondition,
    order: "ASC" | "DESC" = "ASC",
    nulls?: "NULLS FIRST" | "NULLS LAST",
): this {
    if (sort) {
        if (typeof sort === "object") {
            // Centralized validation helper is ONLY triggered for object structures
            this.validateOrderByCondition(sort)
            this.expressionMap.orderBys = sort
        } else {
            // String signature bypasses validation entirely and writes raw values
            if (nulls) {
                this.expressionMap.orderBys = {
                    [sort as string]: { order, nulls },
                }
            } else {
                this.expressionMap.orderBys = { [sort as string]: order }
            }
        }
    }
    return this;
}

During query compilation, the createOrderByExpression method simply performed direct string concatenation, as shown below:

protected createOrderByExpression() {
    const orderBys = this.expressionMap.orderBys
    if (Object.keys(orderBys).length > 0)
        return (
            " ORDER BY " +
            Object.keys(orderBys)
                .map((columnName) => {
                    if (typeof orderBys[columnName] === "string") {
                        return (
                            this.replacePropertyNames(columnName) +
                            " " +
                            orderBys[columnName] // Direct unvalidated string concatenation
                        )
                    }
                    // Object handling logic omitted...
                })
        )
}

Exploitation & PoC Analysis

An attacker exploits this vulnerability by injecting SQL structures into the sorting direction parameter. In MySQL and MariaDB, the ORDER BY clause accepts lists of expressions separated by commas. Consequently, injecting a comma allows the attacker to append a secondary, completely arbitrary SQL statement to the database processor.

To trigger this behavior, an attacker submits a payload structured to introduce a time-based delay, such as ASC, (SELECT SLEEP(5)). If the underlying query builder compiles this string, the resulting database command will call the SLEEP function sequentially for each record matching the update filter. This produces a measurable delay in the HTTP response time.

By systematically altering the parameters of the subquery, the attacker can verify true/false conditions. This allows character-by-character extraction of tables, schemas, and system metadata. Furthermore, because this injection occurs inside an UPDATE or SOFT DELETE statement, it can alter database state as part of the primary transaction.

Impact Assessment

The impact of this SQL injection vulnerability is classified as high because it allows malicious actors to execute arbitrary commands within the database engine. Attackers can bypass built-in access controls, modify critical operational tables, or purge complete datasets. In configurations where database services run with elevated operational privileges, the risk increases dramatically.

If the database configuration permits reading or writing local system files, attackers can leverage SQL injection to write arbitrary web shells to the underlying host. This turns database manipulation into remote code execution. Additionally, attackers can retrieve system variables, environment credentials, and active configuration settings, which compromises connected upstream services.

The CVSS v3.1 vector evaluates to CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N. While the vulnerability is restricted to MySQL and MariaDB installations, these engines power a large percentage of web projects, expanding the threat landscape for unpatched Node.js backends.

Remediation & Defensive Engineering

Remediation requires upgrading the typeorm dependency to a version containing the definitive fix merged in commit 1b66c44d0410bdc56a0dcefb46be41867ec0fffc. This patch secures the library by executing centralized validation across all signatures and adding compilation-time schema checks. This defense-in-depth ensures that malformed payloads fail to compile even if they bypass setter checks.

If upgrading the package immediately is not feasible, developers must implement strict validation layers at the application boundary. Ensure that any variable mapped to the sort direction parameter is restricted strictly to an explicit allowlist consisting of "ASC" or "DESC". This stops the malicious input before it can be processed by TypeORM.

Furthermore, implement database privileges following the principle of least privilege. Limit database users from accessing administrative functions such as administrative sleep APIs or shell-execution privileges. Deploying Web Application Firewalls (WAF) configured with patterns to block semicolon usage, nested subqueries, and commas inside order-by fields provides an additional layer of security.

Fix Analysis (2)

Technical Appendix

CVSS Score
8.1/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

Affected Systems

Applications using TypeORM with MySQL database enginesApplications using TypeORM with MariaDB database engines

Affected Versions Detail

Product
Affected Versions
Fixed Version
typeorm
TypeORM
< 0.3.200.3.20
AttributeDetail
CWE IDCWE-89
Attack VectorNetwork
CVSS v3.1 Score8.1 (High)
Affected DialectsMySQL, MariaDB
Vulnerability ClassSQL Injection
Exploit StatusProof-of-Concept Available
Patch StatusFully Patched (Commit 1b66c44)

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1505Server Software Component
Persistence
T1565Data Manipulation
Impact
T1048Exfiltration Over Alternative Protocol
Exfiltration
CWE-89
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

The software constructs an SQL command using externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements that can modify the intended SQL command.

Known Exploits & Detection

GitHub AdvisoriesProof of concept details and testing validation schema verifying SQL injection strings on unpatched builders.

References & Sources

  • [1]GitHub Security Advisory Details
  • [2]TypeORM Security Advisory Entry
  • [3]Original Pull Request (PR #12217)
  • [4]Initial Patch Commit
  • [5]Definitive Fix Commit

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•2 days ago•CVE-2026-54068
5.9

CVE-2026-54068: Unauthenticated Server-Side Template Injection and SQLite Exfiltration in SiYuan PKM

An authentication bypass in the SiYuan personal knowledge management system before version 3.7.0 exposes a dynamic icon rendering endpoint. This endpoint processes client-supplied Go template directives. By submitting a crafted request, an unauthenticated remote attacker can leverage registered database template functions to execute arbitrary read-only SQL queries and exfiltrate workspace contents.

Amit Schendel
Amit Schendel
14 views•5 min read
•2 days ago•CVE-2026-54069
9.1

CVE-2026-54069: Authentication Bypass in SiYuan Note via Origin Header Spoofing

CVE-2026-54069 is a critical authentication bypass vulnerability in the SiYuan Note personal knowledge management system. The flaw is located in the HTTP server's middleware handling API authorization, which unconditionally trusts requests carrying a 'chrome-extension://' scheme in the Origin HTTP header, granting administrative access without validating API tokens.

Alon Barad
Alon Barad
13 views•5 min read
•2 days ago•CVE-2026-54089
9.1

CVE-2026-54089: Authentication Bypass by Spoofing in File Browser

CVE-2026-54089 is a critical authentication bypass vulnerability in File Browser affecting instances configured with proxy-based authentication. An unauthenticated remote attacker with direct network access can impersonate arbitrary users or register new accounts by spoofing configured HTTP headers.

Amit Schendel
Amit Schendel
13 views•7 min read
•2 days ago•GHSA-99J7-FHR2-XFJ4
10.0

GHSA-99J7-FHR2-XFJ4: Malicious Remote Code Execution Payload in 'exploration' Cargo Crate

The malicious Cargo package 'exploration' was uploaded to the crates.io registry. During compilation or package import, the crate executes code designed to establish an outbound TCP/HTTP connection, download an external second-stage binary, and execute the binary locally on the host machine. This creates an unauthenticated remote code execution vector impacting developer environments and continuous integration pipelines.

Amit Schendel
Amit Schendel
15 views•6 min read
•2 days ago•CVE-2026-54088
9.3

CVE-2026-54088: Pre-Authentication Remote Code Execution in File Browser Hook Authentication

CVE-2026-54088 is a critical command injection vulnerability in File Browser prior to version 2.63.6. When Hook Authentication is enabled, the application interpolates unsanitized credentials into a shell command, allowing unauthenticated remote code execution.

Alon Barad
Alon Barad
14 views•6 min read
•3 days ago•GHSA-QV4M-M73M-8HJ7
8.8

GHSA-qv4m-m73m-8hj7: Authenticated Arbitrary File Upload leading to Remote Code Execution in NotrinosERP

An authenticated remote code execution vulnerability exists in NotrinosERP (versions up to and including 1.0.0) within the Human Resource Management (HRM) module. Users with employee management permissions can upload arbitrary file types, including PHP scripts, which are written directly to a web-accessible directory. This allows for arbitrary code execution in the context of the web-server user.

Alon Barad
Alon Barad
9 views•6 min read