The vulnerability, CVE-2024-4027, is a denial-of-service in Undertow caused by an OutOfMemoryError when processing requests with large parameter names. The root cause is the absence of a default size limit on the request body, which is parsed when a servlet application calls HttpServletRequest.getParameterNames().
The analysis of the provided patch commit 6b7c18481ce65ae4012d92fe2b7f17a21ef4d70b reveals that the fix involves introducing a default 2MB limit for the request entity size (DEFAULT_MAX_ENTITY_SIZE) and multipart entity size (DEFAULT_MULTIPART_MAX_ENTITY_SIZE) in UndertowOptions.java.
This limit is then applied in the multipart parsing logic. Specifically, the function io.undertow.server.handlers.form.MultiPartParserDefinition.exchangeEvent was modified to use this new default limit when setting the maximum entity size for a multipart request. This prevents the server from processing excessively large multipart bodies.
While the patch does not modify io.undertow.servlet.spec.HttpServletRequestImpl.getParameterNames, the vulnerability description clearly identifies it as the trigger. An application developer would use this method, which in turn would invoke the vulnerable underlying parsing logic. Therefore, getParameterNames is a key indicator that would appear in a stack trace during exploitation.
In summary, the identified vulnerable functions are:
io.undertow.server.handlers.form.MultiPartParserDefinition.exchangeEvent: A function directly modified by the patch to enforce size limits, making it a concrete indicator of the fix and the vulnerable path.
io.undertow.servlet.spec.HttpServletRequestImpl.getParameterNames: The API method that initiates the vulnerable process, as highlighted in the CVE description.