Strict validation of content length and chunk length. #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Security researchers @mukeran and @chenjj have reported issues with parsing content length and chunk lengths:
RFC 9112 Section 7.1 defined the format of chunk size, chunk data and chunk extension (detailed ABNF is in Appendix secion).
In a word:
However, we found that Falcon has following behaviors while disobey the corresponding RFCs.
This behavior can lead to desync when forwarding through multiple HTTP parsers, potentially results in HTTP request smuggling and firewall bypassing.
When sending the following requests to the server, falcon successfully parsed our requests and our application successfully read request body.
Impact
The above is a valid assessment of the behaviour of the HTTP/1 parser. However, as this gem does not expose the raw body or forward it in any way, I don't believe it can cause issues in the real world. However, I accept that stricter parsing of the length fields is a good idea.
Regarding chunk extensions, these are ignored and not exposed to the user. Therefore, I don't believe it would be valuable to validate these. Feel free to correct me here.
Actions
Types of Changes
Contribution