CVE-2023-25576

7.5 HIGH

📋 TL;DR

CVE-2023-25576 is a denial-of-service vulnerability in @fastify/multipart plugin where attackers can send unlimited multipart parts (files, fields, or empty parts), causing resource exhaustion and service disruption. This affects Fastify applications using vulnerable versions of the multipart plugin. The vulnerability requires no authentication and can be exploited remotely.

💻 Affected Systems

Products:
  • @fastify/multipart
Versions: All versions before 6.0.1 (for Fastify v3.x) and before 7.4.1 (for Fastify v4.x)
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using the @fastify/multipart plugin with multipart endpoints exposed.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to memory/CPU exhaustion, potentially affecting all users and requiring service restart.

🟠

Likely Case

Degraded performance or temporary service disruption for affected endpoints, leading to user experience issues.

🟢

If Mitigated

Minimal impact with proper rate limiting, request size limits, and monitoring in place.

🌐 Internet-Facing: HIGH - Exploitable remotely without authentication via HTTP requests to multipart endpoints.
🏢 Internal Only: MEDIUM - Internal services could still be affected but attack surface is reduced.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Simple HTTP request with many multipart parts can trigger the vulnerability. Proof of concept available in HackerOne report.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v6.0.1 for Fastify v3.x, v7.4.1 for Fastify v4.x

Vendor Advisory: https://github.com/fastify/fastify-multipart/security/advisories/GHSA-hpp2-2cr5-pf6g

Restart Required: Yes

Instructions:

1. Update package.json to use @fastify/multipart >=6.0.1 (Fastify v3) or >=7.4.1 (Fastify v4). 2. Run 'npm update @fastify/multipart' or 'yarn upgrade @fastify/multipart'. 3. Restart your Fastify application.

🔧 Temporary Workarounds

Rate Limiting

all

Implement request rate limiting to prevent excessive multipart requests

npm install @fastify/rate-limit

Request Size Limits

all

Configure maximum request size and part limits in Fastify multipart options

fastify.register(require('@fastify/multipart'), { limits: { fileSize: 1000000, files: 10, fields: 50 } })

🧯 If You Can't Patch

  • Implement WAF rules to block requests with excessive multipart parts
  • Deploy reverse proxy with request size and rate limiting before the vulnerable application

🔍 How to Verify

Check if Vulnerable:

Check package.json or node_modules/@fastify/multipart/package.json for version <6.0.1 (Fastify v3) or <7.4.1 (Fastify v4)

Check Version:

npm list @fastify/multipart | grep @fastify/multipart

Verify Fix Applied:

Verify installed version is >=6.0.1 (Fastify v3) or >=7.4.1 (Fastify v4) and test multipart endpoints with many parts

📡 Detection & Monitoring

Log Indicators:

  • High memory/CPU usage spikes
  • Multiple multipart requests from single IP
  • Request timeouts on multipart endpoints

Network Indicators:

  • Unusually large HTTP requests to multipart endpoints
  • Many POST requests with Content-Type: multipart/form-data

SIEM Query:

source="application_logs" AND ("multipart" OR "form-data") AND (request_size > 10000000 OR request_duration > 10s)

🔗 References

📤 Share & Export