Headline
GHSA-33pv-vcgh-jfg9: Wagtail vulnerable to denial-of-service via memory exhaustion when uploading large files
Impact
A memory exhaustion bug exists in Wagtail’s handling of uploaded images and documents. For both images and documents, files are loaded into memory during upload for additional processing. A user with access to upload images or documents through the Wagtail admin interface could upload a file so large that it results in a crash or denial of service.
The vulnerability is not exploitable by an ordinary site visitor without access to the Wagtail admin. It can only be exploited by admin users with permission to upload images or documents.
Image uploads are restricted to 10MB by default, however this validation only happens on the frontend and on the backend after the vulnerable code.
Patches
Patched versions have been released as Wagtail 4.1.4 (for the LTS 4.1 branch) and Wagtail 4.2.2 (for the current 4.2 branch).
Workarounds
Site owners who are unable to upgrade to the new versions are encouraged to add extra protections outside of Wagtail to limit the size of uploaded files. Exactly how this is done will vary based on your hosting environment, but here are a few references for common setups:
- Nginx:
client_max_body_size
- Apache:
LimitRequestBody
- Cloudflare: Already imposes a limit of 100MB - 500MB depending on plan
- CloudFront:
SizeConstraint
- Traefik:
traefik.http.middlewares.limit.buffering.maxRequestBodyBytes
The changes themselves are deep inside Wagtail, making patching incredibly difficult.
Impact
A memory exhaustion bug exists in Wagtail’s handling of uploaded images and documents. For both images and documents, files are loaded into memory during upload for additional processing. A user with access to upload images or documents through the Wagtail admin interface could upload a file so large that it results in a crash or denial of service.
The vulnerability is not exploitable by an ordinary site visitor without access to the Wagtail admin. It can only be exploited by admin users with permission to upload images or documents.
Image uploads are restricted to 10MB by default, however this validation only happens on the frontend and on the backend after the vulnerable code.
Patches
Patched versions have been released as Wagtail 4.1.4 (for the LTS 4.1 branch) and Wagtail 4.2.2 (for the current 4.2 branch).
Workarounds
Site owners who are unable to upgrade to the new versions are encouraged to add extra protections outside of Wagtail to limit the size of uploaded files. Exactly how this is done will vary based on your hosting environment, but here are a few references for common setups:
- Nginx: client_max_body_size
- Apache: LimitRequestBody
- Cloudflare: Already imposes a limit of 100MB - 500MB depending on plan
- CloudFront: SizeConstraint
- Traefik: traefik.http.middlewares.limit.buffering.maxRequestBodyBytes
The changes themselves are deep inside Wagtail, making patching incredibly difficult.
References
- GHSA-33pv-vcgh-jfg9
- https://nvd.nist.gov/vuln/detail/CVE-2023-28837
- wagtail/wagtail@3c0c646
- wagtail/wagtail@c9d2fcd
- wagtail/wagtail@cfa11bb
- wagtail/wagtail@d402231
- https://docs.wagtail.org/en/stable/reference/settings.html#wagtailimages-max-upload-size
- https://github.com/wagtail/wagtail/releases/tag/v4.1.4
- https://github.com/wagtail/wagtail/releases/tag/v4.2.2