CVE-2025-54121: CWE-770: Allocation of Resources Without Limits or Throttling in encode starlette
Starlette is a lightweight ASGI (Asynchronous Server Gateway Interface) framework/toolkit, designed for building async web services in Python. In versions 0.47.1 and below, when parsing a multi-part form with large files (greater than the default max spool size) starlette will block the main thread to roll the file over to disk. This blocks the event thread which means the application can't accept new connections. The UploadFile code has a minor bug where instead of just checking for self._in_memory, the logic should also check if the additional bytes will cause a rollover. The vulnerability is fixed in version 0.47.2.
AI Analysis
Technical Summary
CVE-2025-54121 is a medium-severity vulnerability affecting the Starlette framework, a lightweight ASGI toolkit used for building asynchronous web services in Python. The vulnerability exists in versions 0.47.1 and below. It arises from improper resource allocation and throttling when handling multi-part form uploads containing large files exceeding the default maximum spool size. Specifically, when a large file upload triggers a rollover from in-memory buffering to disk storage, the main event thread is blocked during this rollover process. This blocking prevents the application from accepting new incoming connections, effectively causing a denial-of-service (DoS) condition. The root cause is a minor bug in the UploadFile component where the logic only checks if the file is currently in memory (self._in_memory) but fails to consider if the incoming bytes will cause a rollover to disk. This leads to unbounded blocking of the event loop thread during large file uploads. The vulnerability is tracked under CWE-770 (Allocation of Resources Without Limits or Throttling) and has a CVSS 3.1 base score of 5.3 (medium severity), reflecting its network attack vector, low complexity, no privileges or user interaction required, and impact limited to availability. The issue was fixed in Starlette version 0.47.2 by correcting the rollover check logic to prevent blocking the event thread. No known exploits are reported in the wild as of the publication date. However, the vulnerability poses a risk to applications relying on Starlette for asynchronous web services that accept file uploads, as attackers could intentionally upload large files to cause service disruption by exhausting the event loop's ability to handle new requests.
Potential Impact
For European organizations using Starlette versions prior to 0.47.2, this vulnerability could lead to denial-of-service conditions in web services that accept file uploads, particularly those handling large files. The blocking of the main event thread means that legitimate users may experience service outages or degraded performance, impacting business continuity and user experience. This is especially critical for sectors relying on real-time or high-availability asynchronous services, such as financial services, healthcare, e-government portals, and online retail platforms prevalent across Europe. While the vulnerability does not compromise confidentiality or integrity, the availability impact could disrupt critical operations and customer-facing services. Additionally, the ease of exploitation (no authentication or user interaction required) increases the risk of automated or opportunistic attacks targeting vulnerable endpoints. Organizations with public-facing APIs or web applications using Starlette for file uploads are most at risk. The lack of known exploits suggests that proactive patching can effectively mitigate the threat before widespread exploitation occurs.
Mitigation Recommendations
European organizations should immediately assess their use of the Starlette framework and identify any deployments running versions below 0.47.2. The primary mitigation is to upgrade Starlette to version 0.47.2 or later, where the bug in the UploadFile rollover logic is fixed. In addition to patching, organizations should implement the following practical controls: 1) Enforce strict limits on maximum file upload sizes at the application or web server level to prevent excessively large uploads that trigger rollover blocking. 2) Implement asynchronous or background processing for large file uploads to avoid blocking the main event loop. 3) Monitor application performance metrics and event loop responsiveness to detect abnormal blocking or slowdowns indicative of exploitation attempts. 4) Use web application firewalls (WAFs) or API gateways to throttle or block suspicious large multipart/form-data requests. 5) Conduct regular dependency audits and integrate automated vulnerability scanning in CI/CD pipelines to detect outdated Starlette versions. These measures collectively reduce the risk of denial-of-service attacks exploiting this vulnerability and improve overall resilience of asynchronous Python web services.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Denmark, Belgium, Italy, Spain
CVE-2025-54121: CWE-770: Allocation of Resources Without Limits or Throttling in encode starlette
Description
Starlette is a lightweight ASGI (Asynchronous Server Gateway Interface) framework/toolkit, designed for building async web services in Python. In versions 0.47.1 and below, when parsing a multi-part form with large files (greater than the default max spool size) starlette will block the main thread to roll the file over to disk. This blocks the event thread which means the application can't accept new connections. The UploadFile code has a minor bug where instead of just checking for self._in_memory, the logic should also check if the additional bytes will cause a rollover. The vulnerability is fixed in version 0.47.2.
AI-Powered Analysis
Technical Analysis
CVE-2025-54121 is a medium-severity vulnerability affecting the Starlette framework, a lightweight ASGI toolkit used for building asynchronous web services in Python. The vulnerability exists in versions 0.47.1 and below. It arises from improper resource allocation and throttling when handling multi-part form uploads containing large files exceeding the default maximum spool size. Specifically, when a large file upload triggers a rollover from in-memory buffering to disk storage, the main event thread is blocked during this rollover process. This blocking prevents the application from accepting new incoming connections, effectively causing a denial-of-service (DoS) condition. The root cause is a minor bug in the UploadFile component where the logic only checks if the file is currently in memory (self._in_memory) but fails to consider if the incoming bytes will cause a rollover to disk. This leads to unbounded blocking of the event loop thread during large file uploads. The vulnerability is tracked under CWE-770 (Allocation of Resources Without Limits or Throttling) and has a CVSS 3.1 base score of 5.3 (medium severity), reflecting its network attack vector, low complexity, no privileges or user interaction required, and impact limited to availability. The issue was fixed in Starlette version 0.47.2 by correcting the rollover check logic to prevent blocking the event thread. No known exploits are reported in the wild as of the publication date. However, the vulnerability poses a risk to applications relying on Starlette for asynchronous web services that accept file uploads, as attackers could intentionally upload large files to cause service disruption by exhausting the event loop's ability to handle new requests.
Potential Impact
For European organizations using Starlette versions prior to 0.47.2, this vulnerability could lead to denial-of-service conditions in web services that accept file uploads, particularly those handling large files. The blocking of the main event thread means that legitimate users may experience service outages or degraded performance, impacting business continuity and user experience. This is especially critical for sectors relying on real-time or high-availability asynchronous services, such as financial services, healthcare, e-government portals, and online retail platforms prevalent across Europe. While the vulnerability does not compromise confidentiality or integrity, the availability impact could disrupt critical operations and customer-facing services. Additionally, the ease of exploitation (no authentication or user interaction required) increases the risk of automated or opportunistic attacks targeting vulnerable endpoints. Organizations with public-facing APIs or web applications using Starlette for file uploads are most at risk. The lack of known exploits suggests that proactive patching can effectively mitigate the threat before widespread exploitation occurs.
Mitigation Recommendations
European organizations should immediately assess their use of the Starlette framework and identify any deployments running versions below 0.47.2. The primary mitigation is to upgrade Starlette to version 0.47.2 or later, where the bug in the UploadFile rollover logic is fixed. In addition to patching, organizations should implement the following practical controls: 1) Enforce strict limits on maximum file upload sizes at the application or web server level to prevent excessively large uploads that trigger rollover blocking. 2) Implement asynchronous or background processing for large file uploads to avoid blocking the main event loop. 3) Monitor application performance metrics and event loop responsiveness to detect abnormal blocking or slowdowns indicative of exploitation attempts. 4) Use web application firewalls (WAFs) or API gateways to throttle or block suspicious large multipart/form-data requests. 5) Conduct regular dependency audits and integrate automated vulnerability scanning in CI/CD pipelines to detect outdated Starlette versions. These measures collectively reduce the risk of denial-of-service attacks exploiting this vulnerability and improve overall resilience of asynchronous Python web services.
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-07-16T23:53:40.508Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 687ea00aa83201eaac13ae53
Added to database: 7/21/2025, 8:16:10 PM
Last enriched: 7/29/2025, 1:18:59 AM
Last updated: 8/21/2025, 11:48:43 AM
Views: 18
Related Threats
CVE-2025-50722: n/a
UnknownCVE-2025-9410: SQL Injection in lostvip-com ruoyi-go
MediumCVE-2025-29421: n/a
HighCVE-2025-29420: n/a
HighCVE-2025-6737: CWE-1391: Use of Weak Credentials in Securden Unified PAM
HighActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.