<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>@Mikro-Orm/Sql (&lt;= 7.0.13) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/@mikro-orm/sql--7.0.13/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 08 May 2026 19:17:45 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/@mikro-orm/sql--7.0.13/feed.xml" rel="self" type="application/rss+xml"/><item><title>MikroORM SQL Injection Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-mikroorm-sqli/</link><pubDate>Fri, 08 May 2026 19:17:45 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-mikroorm-sqli/</guid><description>MikroORM is vulnerable to SQL injection due to improper escaping in identifier-quoting and JSON-path emitters, enabling attackers to inject arbitrary SQL via manipulated strings passed to public ORM APIs, potentially leading to data leaks, modification, and privilege escalation.</description><content:encoded><![CDATA[<p>MikroORM&rsquo;s identifier-quoting helper (<code>Platform.quoteIdentifier</code> and the postgres/mssql overrides) and its JSON-path emitters (<code>Platform.getSearchJsonPropertyKey</code>, <code>quoteJsonKey</code>) did not properly escape characters that delimit the SQL identifier or string-literal context they emit into. This allows for SQL injection vulnerabilities. When application code passes attacker-influenced strings to public ORM APIs that expect an identifier or a JSON-property filter, an attacker can break out of the quoted context and inject arbitrary SQL. This vulnerability affects all SQL dialects supported by MikroORM, specifically versions 7.0.13 and earlier of <code>@mikro-orm/sql</code> and versions 6.6.13 and earlier of <code>@mikro-orm/knex</code>. The MongoDB driver is not affected.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker identifies an application using a vulnerable version of MikroORM.</li>
<li>The attacker finds an API endpoint that passes user-controlled strings to a vulnerable MikroORM API, such as <code>em.fork({ schema })</code> or <code>em.find(Entity, { jsonCol: { [userKey]: value } })</code>.</li>
<li>The attacker crafts a malicious input string containing SQL injection payloads.</li>
<li>This malicious string is passed to MikroORM&rsquo;s <code>quoteIdentifier</code> or <code>getSearchJsonPropertyKey</code>/<code>quoteJsonKey</code> functions without proper escaping.</li>
<li>The unescaped string is concatenated into a SQL query.</li>
<li>The application executes the crafted SQL query against the database.</li>
<li>The attacker gains unauthorized access to data, modifies data, or elevates privileges.</li>
<li>The attacker exfiltrates sensitive data or performs other malicious actions.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability could allow an attacker to read from any table/schema the database user has access to, leading to cross-tenant data leaks in multi-tenant deployments. On dialects supporting multi-statement queries (MSSQL, MySQL with multi-statement enabled), attackers can execute additional arbitrary SQL statements, potentially leading to data modification and in-database privilege escalation. Availability could also be impacted through DROP/TRUNCATE statements if the database user has the necessary privileges.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade MikroORM to version 7.0.14 or later for v7, and 6.6.14 or later for v6, to patch the vulnerability (refer to Patches section in the content).</li>
<li>For multi-tenant apps using <code>em.fork({ schema })</code> / <code>wrap().setSchema()</code> / <code>qb.withSchema()</code>, validate the schema name against a strict allowlist (e.g. <code>^[A-Za-z_][\w$]*$</code>) before passing it to MikroORM (refer to Workarounds section in the content).</li>
<li>For applications that pass <code>where</code> / <code>orderBy</code> filters from request input, validate every key against the entity&rsquo;s known properties before constructing the filter; do not pass keys containing <code>.</code> or <code>::</code> from user input (refer to Workarounds section in the content).</li>
<li>For applications that allow filtering on JSON columns from request input, validate every JSON sub-key against an allowlist (or against <code>^[a-zA-Z_][\w]*$</code>) before passing it to <code>em.find</code> (refer to Workarounds section in the content).</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>sql-injection</category><category>orm</category><category>mikroorm</category></item></channel></rss>