Skip to content

🐛 Prevent trailing {0} in RawData validation#700

Merged
nevans merged 1 commit into
v0.6.4-patchesfrom
security/fix-raw_data-trailing-literal-marker-validation
Jun 9, 2026
Merged

🐛 Prevent trailing {0} in RawData validation#700
nevans merged 1 commit into
v0.6.4-patchesfrom
security/fix-raw_data-trailing-literal-marker-validation

Conversation

@nevans

@nevans nevans commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

As part of the RawData validation that was added to v0.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 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. (See also #680: the RFCs aren't strict about leading zeros for number64 anyway.)

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.

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.
@nevans nevans added bug Something isn't working security vulnerability patch Pull requests that address security vulnerabilities labels Jun 9, 2026
@nevans nevans changed the base branch from master to v0.6.4-patches June 9, 2026 14:48
@nevans nevans merged commit 5cad699 into v0.6.4-patches Jun 9, 2026
39 checks passed
@nevans nevans deleted the security/fix-raw_data-trailing-literal-marker-validation branch June 9, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security vulnerability patch Pull requests that address security vulnerabilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant