<?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>Python-Multipart — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/python-multipart/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Tue, 02 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/python-multipart/feed.xml" rel="self" type="application/rss+xml"/><item><title>Python-Multipart Denial of Service Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-python-multipart-dos/</link><pubDate>Tue, 02 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-python-multipart-dos/</guid><description>A denial-of-service vulnerability exists in python-multipart versions prior to 0.0.27 due to unbounded multipart part header parsing, allowing attackers to exhaust CPU resources by sending requests with many repeated headers or a single oversized header value.</description><content:encoded><![CDATA[<p>The <code>python-multipart</code> library is vulnerable to a denial-of-service (DoS) attack due to unbounded header parsing. This vulnerability affects applications parsing <code>multipart/form-data</code> using versions of <code>python-multipart</code> prior to 0.0.27. An attacker can exploit this by sending a crafted HTTP request containing either numerous repeated headers without terminating the header block or a single, excessively large header value. This leads to excessive CPU consumption as the server attempts to parse the oversized or numerous headers, potentially causing significant delays or service interruption. ASGI applications such as Starlette and FastAPI, which rely on <code>python-multipart</code>, are particularly susceptible.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious HTTP POST request with a <code>multipart/form-data</code> content type.</li>
<li>The malicious request contains either a large number of repeated header lines or a single, oversized header value within a multipart part.</li>
<li>The request is sent to a web server running an application that uses <code>python-multipart</code> to parse multipart form data.</li>
<li>The <code>MultipartParser</code> in <code>python-multipart</code> attempts to parse the headers.</li>
<li>Due to the lack of limits on header count and size in vulnerable versions, the parsing process consumes excessive CPU resources.</li>
<li>The server&rsquo;s worker or event loop becomes delayed while processing the malicious request.</li>
<li>This delay can lead to a denial of service, as the server is unable to efficiently handle legitimate requests.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability leads to CPU exhaustion on the targeted server, causing delays or interruptions in service. ASGI applications utilizing Starlette, FastAPI, or similar frameworks are at risk. The number of victims depends on the popularity and exposure of the affected applications. The impact includes potential downtime, reduced application performance, and a negative user experience.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to <code>python-multipart</code> version 0.0.27 or later to apply the fix that enforces limits on header count and size.</li>
<li>If an immediate upgrade is not feasible, implement request body size limits at the server, proxy, or framework level to reduce the potential impact, as recommended in the advisory.</li>
<li>Monitor web server logs for requests with unusually large header sizes or a high number of headers, using detection rules targeting anomalous header behavior.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>denial-of-service</category><category>python-multipart</category><category>web-application</category></item></channel></rss>