You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cheroot allows all of the following characters within method names, even though they do not conform to the method ABNF rule from the HTTP RFCs:
\x00-\x09 inclusive
\x0b-\x1f inclusive
\x22,
\x28,
\x29,
\x2c,
\x2f-\x40 inclusive,
\x5b-\x5d inclusive,
\x7b,
\x7d,
\x7f-\xff inclusive.
β What is the motivation / use case for changing the behavior?
The current behavior violates the HTTP RFCs and can hinder interoperability. For example, caching gateways that interpret GET\r as equivalent to GET, but forward the method as-is, will potentially be vulnerable to cache poisoning when paired with Cheroot due to this behavior.
HTTP/1.1 200 OK
Content-type: application/json
Content-Length: 109
Date: Sat, 08 Jun 2024 15:56:59 GMT
Server: Cheroot/10.0.2.dev71+g1ff20b18
{"headers":[["SE9TVA==","d2hhdGV2ZXI="]],"body":"","version":"SFRUUC8xLjE=","uri":"Lw==","method":"R0VUAA=="}
Base64-decode the method to see that the null byte is preserved:
$ printf'R0VUAA=='| base64 -d | xxd
00000000: 4745 5400 GET.
π‘ Expected behavior
Cheroot should respond 400 to requests with syntactically invalid methods. 501 is not an acceptable response code in this scenario because it is cacheable, so cache poisoning remains possible.
π Environment
Cheroot version: 10.0.2.dev71+g1ff20b18
Python version: 3.11.9
OS: Linux 6.9.1
The text was updated successfully, but these errors were encountered:
β I'm submitting a ...
π Describe the bug. What is the current behavior?
RFC 9110 defines the following ABNF rules for HTTP methods:
Cheroot allows all of the following characters within method names, even though they do not conform to the method ABNF rule from the HTTP RFCs:
\x00
-\x09
inclusive\x0b
-\x1f
inclusive\x22
,\x28
,\x29
,\x2c
,\x2f
-\x40
inclusive,\x5b
-\x5d
inclusive,\x7b
,\x7d
,\x7f
-\xff
inclusive.β What is the motivation / use case for changing the behavior?
The current behavior violates the HTTP RFCs and can hinder interoperability. For example, caching gateways that interpret
GET\r
as equivalent toGET
, but forward the method as-is, will potentially be vulnerable to cache poisoning when paired with Cheroot due to this behavior.π‘ To Reproduce
π‘ Expected behavior
Cheroot should respond 400 to requests with syntactically invalid methods. 501 is not an acceptable response code in this scenario because it is cacheable, so cache poisoning remains possible.
π Environment
The text was updated successfully, but these errors were encountered: