Repository navigation
Validate OCSP HTTP request inputs - #3639
Merged
Merged
Conversation
OCSP_REQ_CTX_http and OCSP_REQ_CTX_add1_header copied caller strings straight into the HTTP request. A path, method, header name, or header value that held CR or LF could end the line early and add headers or a second request. The path often comes from a certificate's AIA extension, so an attacker can control it. Both functions now reject any such input before they write to the request buffer, and raise the new OCSP_R_INVALID_HTTP_HEADER error. OCSP_REQ_CTX_http also rejects a NULL method. This matches OpenSSL, which rejects CR and LF in the same places.
prasden
force-pushed
the
fix-ocsp-http-crlf
branch
from
October 9, 2026 19:00
289cb41 to
5f75b08
Compare
Contributor
|
🔒 Security Review — View Report Please review before merging. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3639 +/- ##
==========================================
- Coverage 78.69% 78.47% -0.23%
==========================================
Files 705 705
Lines 130689 130710 +21
Branches 17919 17921 +2
==========================================
- Hits 102850 102574 -276
- Misses 26860 27160 +300
+ Partials 979 976 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
samuel40791765
approved these changes
Oct 11, 2026
prasden
enabled auto-merge (squash)
October 12, 2026 20:49
spwalgren
approved these changes
Oct 13, 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.
Related issues
P498748746Note
518/599 added lines is the regenerated
generated-src/err_data.c.Context and motivation
OCSP_REQ_CTX_httpandOCSP_REQ_CTX_add1_headercopy caller strings into the HTTP request without checking for line break characters (\ror\n).A path from a certificate's AIA extension, such as
/ocsp\r\nX-Evil: 1, can then end a line early and add headers or a second request.Description of changes
Both functions now reject any method, path, header name, or header value that holds
\ror\n. They do this before they write anything, and they raise the newOCSP_R_INVALID_HTTP_HEADERerror.OCSP_REQ_CTX_httpalso rejects a NULL method, which it used to pass toBIO_printfas a NULL%s.Testing
The new
OCSPRequestHeaderTestputs\r\n,\r, and\ninto each of the method, path, header name, and header value. Each case must fail with the expected error and write nothing to the BIO.Regenerated
generated-src/err_data.cfor the new error.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.