<?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/" xmlns:webfeeds="http://webfeeds.org/rss/1.0"><channel><title>Compiler (&lt;= 1.15.0) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/compiler--1.15.0/</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>Tue, 08 Sep 2026 21:49:29 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/compiler--1.15.0/feed.xml" rel="self" type="application/rss+xml"/><image><url>https://feed.craftedsignal.io/favicon-32x32.png</url><title>CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/</link><width>32</width><height>32</height></image><webfeeds:icon>https://feed.craftedsignal.io/favicon.svg</webfeeds:icon><item><title>Path Traversal in TypeSpec OpenAPI3 Emitter</title><link>https://feed.craftedsignal.io/briefs/2026-09-typespec-path-traversal/</link><pubDate>Tue, 08 Sep 2026 21:49:29 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-09-typespec-path-traversal/</guid><description>The @typespec/openapi3 emitter fails to sanitize version-derived path tokens, allowing arbitrary file creation or overwrite outside the intended output directory.</description><content:encoded><![CDATA[<p>The <code>@typespec/openapi3</code> emitter package is vulnerable to a path traversal flaw caused by improper sanitization of user-controlled input. Specifically, the value of a <code>@versioned</code> enum member in a TypeSpec (<code>.tsp</code>) file is interpolated directly into the output filename template without checking for path traversal characters (<code>..</code>) or absolute path indicators. During the emission process, the TypeSpec compiler's <code>emitFile</code> function performs no validation to ensure the resolved path remains within the designated <code>emitterOutputDir</code>.</p>
<p>An attacker capable of providing a malicious <code>.tsp</code> file to the compiler can force the application to write or overwrite files anywhere on the local filesystem that the compiler process has write access to. While the written content is constrained to valid OpenAPI YAML or JSON structures, the ability to overwrite configuration files or sensitive application data allows for potential denial-of-service or system instability. This vulnerability affects the TypeSpec compiler stack, specifically <code>openapi3</code> and <code>compiler</code> versions <code>1.15.0</code> and earlier.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker crafts a malicious TypeSpec source file (<code>.tsp</code>) containing a <code>@versioned</code> enum member.</li>
<li>The attacker sets a version value containing directory traversal sequences, such as <code>../../../../tmp/target_file</code>.</li>
<li>The attacker invokes the TypeSpec compiler on the malicious source file.</li>
<li>The <code>openapi3</code> emitter reads the crafted version value during the serialization of the OpenAPI specification.</li>
<li>The compiler performs path interpolation using the malicious version string, constructing a path that points outside the <code>emitterOutputDir</code>.</li>
<li>The <code>emitFile</code> utility executes the file write operation using the resolved traversal path.</li>
<li>The target file on the host filesystem is overwritten with the generated OpenAPI YAML/JSON content.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows for arbitrary file creation or overwrite, leading to file corruption and potential denial-of-service scenarios. The impact is limited to the compiler process's filesystem permissions and the file formats supported by the emitter, precluding direct remote code execution or unauthorized file disclosure in the documented exploitation path.</p>
<h2 id="recommendation">Recommendation</h2>
<p>Prioritize the implementation of path sanitization within the TypeSpec compiler emission pipeline.</p>
<ul>
<li>Implement logic in the <code>openapi3</code> emitter to resolve the absolute path of the output file after token interpolation and verify it resides within the <code>emitterOutputDir</code>.</li>
<li>Slugify or strictly validate all filename tokens derived from spec attributes to strip path separators, absolute path prefixes, and traversal components.</li>
<li>Audit and patch <code>packages/compiler/src/core/emitter-utils.ts</code> to enforce filesystem containment checks during the <code>writeFile</code> routine.</li>
<li>Review all TypeSpec projects for usage of externally supplied or untrusted input in <code>@versioned</code> enum definitions.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>path-traversal</category><category>file-write</category><category>typespec</category><category>supply-chain</category></item></channel></rss>