"request_body_timeout" does not stop slow request bodies
Description
Caddy replaces FrankenPHP's read deadline, making request_body_timeout ineffective against slow request bodies.
Details
go_read_post sets the configured deadline before PHP reads the body. Caddy 2.11.7 wraps the body with IdleTimeoutReader, which replaces that deadline before the network read.
Proof of concept
Run FrankenPHP with two threads and:
php_server {
request_body_timeout 100ms
}Open two HTTP/1.1 connections. On each, send a POST with Content-Length: 100, send one body byte, then stop. After one second, request a fast PHP endpoint with a two-second timeout.
The fast request times out. Both threads remain blocked until the slow clients close.
Impact
An unauthenticated client can block every PHP thread with one slow connection per thread. Occasional body bytes can extend the block.
Status
caddyserver/caddy#8145, which this advisory was closed on, only lets handler write deadlines cap Caddy's idle write timeout. The read side is unchanged: IdleTimeoutReader still sets its own deadline before each body read, so request_body_timeout has no effect behind Caddy, whose read_body idle timeout (1 minute by default) applies instead. This was confirmed again on 1.13.4.
Patches
- caddyserver/caddy#8284 makes Caddy's idle body reader keep a read deadline set by a handler as a ceiling, instead of replacing it before each read. This alone fixes the proof of concept above.
- FrankenPHP no longer clears the read deadline once it has expired. Without this, when a script writes more than the response buffer after a timed-out read,
net/httpdrains the rest of the body on the PHP thread with no deadline, behind Caddy and with the library alike.
The fix ships in the first FrankenPHP release built with a Caddy version that includes caddyserver/caddy#8284.
Bodies that PHP doesn't read at request startup (PUT, PATCH, DELETE, or POST with enable_post_data_reading=Off) are still drained without a deadline when the script writes more than the response buffer or calls flush() before reading them. This is tracked separately.
Workarounds
Lower Caddy's own body idle timeout, which is the one in effect behind Caddy:
{
servers {
timeouts {
read_body 10s
}
}
}Credits
Reported by @alexandre-daubois. Also discovered by Anthropic's OSS Scanner, as vulnerability ANT-2026-SOADHUU9.