@seroval/transport FormData plugin copies one shared entries list once per plugin value
Description
The FormData support in @seroval/transport can copy the same decoded list of entries many times when decoding untrusted form data. This is uncontrolled resource consumption (CWE-400, CWE-405). A small request body can make the decoder allocate many times its own size.
Impact
Applications are affected when they decode untrusted input with fromFormData or fromFormRequest.
A body can make many FormData values share one list of entries. Each FormData value makes its own full copy of the list. From a request body of a few hundred kilobytes, an attacker can make a server process allocate hundreds of megabytes before application code sees the value. This can exhaust memory and deny service to other users.
This is the same class as GHSA-g966-mc3v-w67r in seroval-plugins, which @seroval/transport did not carry over.
Affected versions
@seroval/transport <= 0.1.2
Patches
Fixed in @seroval/transport 0.1.3. Upgrade to 0.1.3 or later.
Workarounds
Keep request bodies small on endpoints that call fromFormData or fromFormRequest with untrusted input.
References
- GHSA-g966-mc3v-w67r