CVE-2024-31217: @strapi/plugin-upload has a Denial-of-Service via Improper Exception Handling

Published Jun 12, 2024
·
Updated

Summary A Denial-of-Service was found in the media upload process causing the server to crash without restarting, affecting either development and production environments.

Details Usually, errors in the application cause it to log the error and keep it running for other clients. This behavior, in contrast, stops the server execution, making it unavailable for any clients until it's manually restarted.

PoC Due to a bug in what we believe to be Burp’s decoding system, we couldn’t produce a valid file to easily reproduce the vulnerability. Instead, the issue can be reproduced by following these steps: 1. Configure Burp’s proxy between a browser and a Strapi server 2. Log in and upload an image through the Media Library page while having Burp’s interceptor turned on 3. After capturing the upload POST request in Burp, add %00 at the end of the file extension from the Content-Disposition, in the filename parameter (See reference image 1 below) 4. Using the cursor, select the added %00 and right-click it. Click in Convert selection > URL > URL decode to transform the selected text into a null byte 5. Forward the modified request. The server should print an error and crash with the error ERRINVALIDARGVALUE (See reference log 1 below)

By following the data flow, we reached the line of code where we believe the DoS is being caused. The simpler way of fixing this vulnerability seems to be avoiding the error thrown by whitelisting the characters used in the extension.

Reference Image 1 !image

Reference Log 1 [2024-03-22 10:23:42.629] http: POST /upload (22 ms) 400 node:internal/fs/utils:379 const err = new ERRINVALIDARGVALUE( ^

TypeError [ERRINVALIDARGVALUE]: The argument 'path' must be a string, Uint8Array, or URL without null bytes. Received '/mnt/storage/Development/GHSA-pm9q-xj9p-96pm/public/uploads/replacemepng88efe6a165.png\x00' at new WriteStream (node:internal/fs/streams:340:5) at Object.createWriteStream (node:fs:3123:10) at /mnt/storage/Development/GHSA-pm9q-xj9p-96pm/nodemodules/@strapi/provider-upload-local/dist/index.js:71:33 at new Promise (<anonymous>) at Object.uploadStream (/mnt/storage/Development/GHSA-pm9q-xj9p-96pm/nodemodules/@strapi/provider-upload-local/dist/index.js:68:16) at Object.uploadStream (/mnt/storage/Development/GHSA-pm9q-xj9p-96pm/nodemodules/@strapi/plugin-upload/server/register.js:80:35) at Object.upload (/mnt/storage/Development/GHSA-pm9q-xj9p-96pm/nodemodules/@strapi/plugin-upload/server/services/provider.js:16:46) at Object.uploadImage (/mnt/storage/Development/GHSA-pm9q-xj9p-96pm/nodemodules/@strapi/plugin-upload/server/services/upload.js:220:48) { code: 'ERRINVALIDARGVALUE' }

Impact Denial-of-Service occurs when a service becomes unavailable for users or other services. By sending a specially-crafted request, the server crashes without restarting. The entire server crashes with the thrown error instead of crashing only the single request and returning error 500 to the user. Any user with access to the file upload functionality is able to exploit this vulnerability, affecting applications running in both development mode and production mode as well.

Other sources

Strapi is an open-source content management system. Prior to version 4.22.0, a denial-of-service vulnerability is present in the media upload process causing the server to crash without restarting, affecting either development and production environments. Usually, errors in the application cause it to log the error and keep it running for other clients. This behavior, in contrast, stops the server execution, making it unavailable for any clients until it's manually restarted. Any user with access to the file upload functionality is able to exploit this vulnerability, affecting applications running in both development mode and production mode as well. Users should upgrade @strapi/plugin-upload to version 4.22.0 to receive a patch.

NVD

Affected Software

2 affected componentsFixes available
npm/@strapi/plugin-upload<4.22.0
4.22.0
Strapi Strapi<4.22.0

Event History

Jun 12, 2024
CVE Published
via MITRE·02:50 PM
Data Sourced
via MITRE·02:50 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·07:38 PM

Frequently Asked Questions

1

What is the severity of CVE-2024-31217?

CVE-2024-31217 is classified as a Denial-of-Service vulnerability that can cause the server to crash.

2

How do I fix CVE-2024-31217?

To fix CVE-2024-31217, upgrade the @strapi/plugin-upload to version 4.22.1 or later.

3

Which software is affected by CVE-2024-31217?

CVE-2024-31217 affects Strapi applications using @strapi/plugin-upload versions prior to 4.22.1.

4

What kind of environments are impacted by CVE-2024-31217?

CVE-2024-31217 affects both development and production environments.

5

Can CVE-2024-31217 be exploited remotely?

Yes, CVE-2024-31217 can potentially be exploited remotely through the media upload process.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203