Puma with proxy which forwards LF characters as line endings could allow HTTP request smuggling
### Impact Prior to `puma` version 5.5.0, using `puma` with a proxy which forwards LF characters as line endings could allow HTTP request smuggling. A client could smuggle a request through a proxy, causing the proxy to send a response back to another unknown client. This behavior (forwarding LF characters as line endings) is very uncommon amongst proxy servers, so we have graded the impact here as "low". Puma is only aware of a single proxy server which has this behavior. If the proxy uses persistent connections and the client adds another request in via HTTP pipelining, the proxy may mistake it as the first request's body. Puma, however, would see it as two requests, and when processing the second request, send back a response that the proxy does not expect. If the proxy has reused the persistent connection to Puma to send another request for a different client, the second response from the first client will be sent to the second client. ### Patches This vulnerability was patched in Puma 5.5.1 and 4.3.9. ### Workarounds This vulnerability only affects Puma installations without any proxy in front. Use a proxy which does not forward LF characters as line endings. Proxies which do not forward LF characters as line endings: * Nginx * Apache (>2.4.25) * Haproxy * Caddy * Traefik ### Possible Breakage If you are [dealing with legacy clients that want to send `LF` as a line ending](https://stackoverflow.com/questions/43574428/have-apache-accept-lf-vs-crlf-in-request-headers) in an HTTP header, this will cause those clients to receive a `400` error. ### References * [HTTP Request Smuggling](https://portswigger.net/web-security/request-smuggling) ### For more information If you have any questions or comments about this advisory: * Open an issue in [Puma](https://github.com/puma/puma) * See our [security policy](https://github.com/puma/puma/security/policy)
02 / AFFECTED SOFTWARE
Affected packages
138 explicit affected versions
109 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
### Impact Prior to `puma` version 5.5.0, using `puma` with a proxy which forwards LF characters as line endings could allow HTTP request smuggling. A client could smuggle a request through a proxy, causing the proxy to send a response back to another unknown client. This behavior (forwarding LF characters as line endings) is very uncommon amongst proxy servers, so we have graded the impact here as "low". Puma is only aware of a single proxy server which has this behavior. If the proxy uses persistent connections and the client adds another request in via HTTP pipelining, the proxy may mistake it as the first request's body. Puma, however, would see it as two requests, and when processing the second request, send back a response that the proxy does not expect. If the proxy has reused the persistent connection to Puma to send another request for a different client, the second response from the first client will be sent to the second client. ### Patches This vulnerability was patched in Puma 5.5.1 and 4.3.9. ### Workarounds This vulnerability only affects Puma installations without any proxy in front. Use a proxy which does not forward LF characters as line endings. Proxies which do not forward LF characters as line endings: * Nginx * Apache (>2.4.25) * Haproxy * Caddy * Traefik ### Possible Breakage If you are [dealing with legacy clients that want to send `LF` as a line ending](https://stackoverflow.com/questions/43574428/have-apache-accept-lf-vs-crlf-in-request-headers) in an HTTP header, this will cause those clients to receive a `400` error. ### References * [HTTP Request Smuggling](https://portswigger.net/web-security/request-smuggling) ### For more information If you have any questions or comments about this advisory: * Open an issue in [Puma](https://github.com/puma/puma) * See our [security policy](https://github.com/puma/puma/security/policy)
Puma is a HTTP 1.1 server for Ruby/Rack applications. Prior to versions 5.5.1 and 4.3.9, using `puma` with a proxy which forwards HTTP header values which contain the LF character could allow HTTP request smugggling. A client could smuggle a request through a proxy, causing the proxy to send a response back to another unknown client. The only proxy which has this behavior, as far as the Puma team is aware of, is Apache Traffic Server. If the proxy uses persistent connections and the client adds another request in via HTTP pipelining, the proxy may mistake it as the first request's body. Puma, however, would see it as two requests, and when processing the second request, send back a response that the proxy does not expect. If the proxy has reused the persistent connection to Puma to send another request for a different client, the second response from the first client will be sent to the second client. This vulnerability was patched in Puma 5.5.1 and 4.3.9. As a workaround, do not use Apache Traffic Server with `puma`.
05 / REFERENCES
Further evidence
- https://github.com/puma/puma
- https://github.com/puma/puma/commit/436c71807f00e07070902a03f79fd3e130eb6b18
- https://github.com/puma/puma/commit/acdc3ae571dfae0e045cf09a295280127db65c7f
- https://github.com/puma/puma/commit/fb6ad8f8013ab5cdbb2f444cbfabd0b4fde71139
- https://github.com/puma/puma/releases/tag/v4.3.9
- https://github.com/puma/puma/releases/tag/v5.5.1
- https://github.com/puma/puma/security/advisories/GHSA-48w2-rm65-62xx
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/puma/CVE-2021-41136.yml
- https://lists.debian.org/debian-lts-announce/2022/08/msg00015.html
- https://nvd.nist.gov/vuln/detail/CVE-2021-41136
- https://security.gentoo.org/glsa/202208-28
- https://www.debian.org/security/2022/dsa-5146