The vulnerability is a CRLF injection in Netty's HttpPostRequestEncoder. It occurs because the filename in a multipart form data request is not properly sanitized for carriage return (CR) and line feed (LF) characters. An attacker can provide a crafted filename, for example during a file upload, which includes CRLF sequences followed by arbitrary MIME headers.
The root cause was traced to the setFilename methods in io.netty.handler.codec.http.multipart.DiskFileUpload and io.netty.handler.codec.http.multipart.MemoryFileUpload. These methods only performed a null check and did not validate the filename for illegal characters. When HttpPostRequestEncoder later constructs the multipart body, it concatenates this unvalidated filename directly into the Content-Disposition header, allowing the injected headers to be written into the request body.
The patch addresses this by introducing a new utility method, FileUploadUtil.validateFileNameForMultiPart, which checks for control characters (including CR and LF), DEL, double-quotes, and backslashes. The setFilename methods in DiskFileUpload and MemoryFileUpload were updated to use this new validation method, thus preventing the injection at the source. During exploitation, a profiler would show calls to setFilename on a FileUpload object, followed by a call to HttpPostRequestEncoder.addBodyHttpData to add the malicious part, and finally HttpPostRequestEncoder.readChunk where the multipart body with the injected headers is actually constructed.