axum-core has no default limit put on request bodies
High severity
GitHub Reviewed
Published
Sep 15, 2022
to the GitHub Advisory Database
•
Updated Jan 12, 2023
Description
Published to the GitHub Advisory Database
Sep 15, 2022
Reviewed
Sep 15, 2022
Last updated
Jan 12, 2023
<bytes::Bytes as axum_core::extract::FromRequest>::from_requestwould not, by default, set a limit for the size of the request body. That meant if a malicious peer would send a very large (or infinite) body your server might run out of memory and crash.This also applies to these extractors which used
Bytes::from_requestinternally:axum::extract::Formaxum::extract::JsonStringThe fix is also in
axum-core0.3.0.rc.2but0.3.0.rc.1is vulnerable.Because
axumdepends onaxum-coreit is vulnerable as well. The vulnerable versions ofaxumare<= 0.5.15and0.6.0.rc.1.axum>= 0.5.16and>= 0.6.0.rc.2does have the fix and are not vulnerable.The patched versions will set a 2 MB limit by default.
References