Servlets with multipart support (e.g. annotated with @MultipartConfig
) that call HttpServletRequest.getParameter()
or HttpServletRequest.getParts()
may cause OutOfMemoryError
when the client sends a multipart request with a part that has a name but no filename and a very large content.
This happens even with the default settings of fileSizeThreshold=0
which should stream the whole part content to disk.
An attacker client may send a large multipart request and cause the server to throw OutOfMemoryError
.
However, the server may be able to recover after the OutOfMemoryError
and continue its service -- although it may take some time.
A very large number of parts may cause the same problem.
Patched in Jetty versions
Multipart parameter maxRequestSize
must be set to a non-negative value, so the whole multipart content is limited (although still read into memory).
Limiting multipart parameter maxFileSize
won't be enough because an attacker can send a large number of parts that summed up will cause memory issues.
{ "nvd_published_at": "2023-04-18T21:15:08Z", "cwe_ids": [ "CWE-400", "CWE-770" ], "severity": "MODERATE", "github_reviewed": true, "github_reviewed_at": "2023-04-19T18:15:45Z" }