🐛 Prevent trailing {0} in RawData validation#700
Merged
nevans merged 1 commit intoJun 9, 2026
Merged
Conversation
Zero-length literals are explicitly allowed by the RFCs and this did not
catch text that ends with `{0}` or `{0+}`. This leaves RawData able to
absorb the `CRLF` that ends the command, and thus absorb the following
command into itself.
Ultimately, we don't care if the `number64` is encoded correctly nor
whether it claims to be a binary literal. So I've simplified the regexp
by dropping `~?` and using `\d+` for the number.
This was referenced Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As part of the
RawDatavalidation that was added tov0.6.4, raw data was checked to ensure it doesn't end with a literal continuation. However the regexp was too strict. Zero-length literals are explicitly allowed by the RFCs, so this did not catch text that ends with{0}or{0+}. This leaves RawData able to absorb theCRLFthat ends the command, and thus absorb the following command into itself.Ultimately, we don't care if the
number64is encoded correctly nor whether it claims to be a binary literal. So I've simplified the regexp by dropping~?and using\d+for the number. (See also #680: the RFCs aren't strict about leading zeros fornumber64anyway.)Exploiting this will result in unexpected crashes and timeouts, which could be used to create a simple denial of service attack. This attack will present very similarly to common network issues or server issues which also result in commands hanging or unexpectedly raising exceptions. By itself, this does not allow command injection. But the confusion caused by these errors could lead to other downstream issues, especially in a multi-threaded environment.