Intel

AIKIDO-2026-929875

@mikro-orm/mssql is vulnerable to SQL Injection

SQL Injection Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published 5 days ago

64

Medium Risk

This Affects:

JS@mikro-orm/mssql
6.2.0 - 6.6.15
Fixed in 6.6.16
7.0.0 - 7.1.6
Fixed in 7.1.7
Are you affected? Scan for Free

TL;DR

The MSSQL platform builds ORDER BY clauses by lowercasing the requested sort direction and embedding it directly into the generated SQL. The order-by field key is validated against entity metadata, but the direction value is not checked against the known QueryOrder values, so an application that forwards a user-controlled direction into orderBy lets crafted tokens reach the query. On MSSQL this can break out of the intended clause and inject arbitrary SQL, including additional statements. The fix adds a validateOrderByDirection() allow-list that rejects any direction outside the canonical ascending and descending variants.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application passes a user-controlled or otherwise untrusted order-by direction value into a query.

Background info

@mikro-orm/mssql is vulnerable to SQL Injection in versions 6.2.0 - 6.6.15 and 7.0.0 - 7.1.6.

How to fix this

Upgrade the @mikro-orm/mssql library to the patch version.