<?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>Cwe-915 — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/cwe-915/</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>Mon, 11 May 2026 19:42:38 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/cwe-915/feed.xml" rel="self" type="application/rss+xml"/><item><title>Kysely JSON-path Injection Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2026-05-kysely-jsonpath-injection/</link><pubDate>Mon, 11 May 2026 19:42:38 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-05-kysely-jsonpath-injection/</guid><description>A JSON-path traversal injection vulnerability exists in Kysely versions prior to 0.28.16, allowing attackers to traverse JSON sub-fields outside the intended scope, potentially leading to unauthorized read and write access to sensitive data in MySQL, PostgreSQL, and SQLite databases due to insufficient sanitization of JSON-path metacharacters in the `JSONPathBuilder.key()` and `.at()` functions.</description><content:encoded><![CDATA[<p>A JSON-path injection vulnerability has been identified in Kysely, a TypeScript SQL query builder, affecting MySQL, PostgreSQL <code>-&gt;$</code>/<code>-&gt;&gt;$</code>, and SQLite dialects. The vulnerability stems from insufficient sanitization of JSON-path metacharacters (<code>.</code>, <code>[</code>, <code>]</code>, <code>*</code>, <code>**</code>, <code>?</code>) in the <code>JSONPathBuilder.key()</code> and <code>.at()</code> functions.  Specifically, Kysely 0.28.12 added a <code>sanitizeStringLiteral()</code> call inside <code>DefaultQueryCompiler.visitJSONPathLeg</code> (commit <code>0a602bf</code>, PR #1727) to fix CVE-2026-32763 (<code>GHSA-wmrf-hv6w-mr66</code>), however this fix only escapes single quotes, and not the other JSON-path metacharacters. This allows attackers to traverse from the intended key into sibling and child fields, potentially exposing sensitive data that was intended to be private. The vulnerability can be exploited even in type-safe code where the JSON column is shaped like <code>Record&lt;string, T&gt;</code>. The affected code resides primarily in <code>src/query-compiler/default-query-compiler.ts</code> and <code>src/query-builder/json-path-builder.ts</code>.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker identifies a Kysely-based application that uses <code>eb.ref(col, '-&gt;$').key(input)</code> or <code>.at(input)</code> to construct JSON path queries.</li>
<li>The application&rsquo;s JSON column is typed as <code>Record&lt;string, T&gt;</code>, which allows attacker-controlled input to be passed to <code>.key()</code> without triggering type errors.</li>
<li>The attacker crafts a malicious input string containing JSON-path metacharacters (e.g., <code>nick.secret_field</code>, <code>*</code>, <code>[].secret]</code>).</li>
<li>The attacker-controlled input is passed to the <code>key()</code> or <code>at()</code> function, which constructs a JSON path expression.</li>
<li>The <code>visitJSONPathLeg</code> function in <code>default-query-compiler.ts</code> is called to compile the JSON path.</li>
<li>The <code>sanitizeStringLiteral</code> function is called on the attacker-controlled input, but it only escapes single quotes and does not neutralize other JSON-path metacharacters.</li>
<li>The compiled SQL query, containing the unescaped metacharacters, is executed against the database.</li>
<li>The database interprets the metacharacters as JSON path operators, allowing the attacker to access or modify unintended JSON sub-fields, leading to data disclosure or unauthorized modification of data.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability can lead to unauthorized access to sensitive data stored within JSON columns, including SSNs, tokens, and admin flags. In MySQL and PostgreSQL, attackers can use wildcards to enumerate all values at the current depth or recursively across the entire document. In update statements, attackers can modify nested fields, potentially escalating privileges or altering application behavior. The vulnerability bypasses previous hardening attempts, making applications that relied on the earlier fix vulnerable again. The impact is significant for applications that handle sensitive data in JSON format and expose JSON path queries to user input.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply a dedicated <code>sanitizeJSONPathLeg</code> function that only emits a known-good character set per leg type and rejects everything else as described in the advisory.</li>
<li>Deploy the Sigma rule &ldquo;Detect Kysely JSON-path Injection Attempts&rdquo; to monitor for attempted exploitation by detecting path traversal metacharacters.</li>
<li>Audit all code that uses <code>eb.ref(col, '-&gt;$').key(input)</code> or <code>.at(input)</code> to ensure that user-supplied input is properly validated and sanitized.</li>
<li>Upgrade to Kysely version 0.28.17 (or later) once it is released to incorporate the necessary security fixes.</li>
<li>Review database logs for suspicious JSON path queries containing unexpected metacharacters (e.g. <code>.</code> <code>*</code> <code>[]</code>) targeting JSON columns to identify potential exploitation attempts.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>jsonpath</category><category>injection</category><category>kysely</category><category>cwe-89</category><category>cwe-915</category><category>cwe-1284</category></item></channel></rss>