Reject CR/LF in OCSP/CRL URLs to block HTTP injection#10628
Reject CR/LF in OCSP/CRL URLs to block HTTP injection#10628yosuke-wolfssl wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens OCSP/CRL URL handling to prevent CR/LF injection (HTTP request splitting / header injection) when building outbound HTTP requests from attacker-controlled certificate URLs during peer verification.
Changes:
- Reject
\r/\ninwolfIO_DecodeUrl()while copying IPv6 bracket hosts, normal hosts, and paths. - Add a sink-side CR/LF scan in
wolfIO_HttpBuildRequest_ex()to block injection even when URL parsing is bypassed (e.g., CRL absolute-form/raw URL request target). - Add a new OCSP API test and register it in the API test runner.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/wolfio.c |
Adds CR/LF rejection in URL decode and HTTP request building to prevent HTTP injection from certificate-controlled URL components. |
tests/api/test_ocsp.c |
Adds a regression test validating CR/LF rejection in decoded URLs and in the HTTP request builder. |
tests/api/test_ocsp.h |
Declares the new regression test. |
tests/api.c |
Registers the new regression test in the test case list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b9bf9fa to
e08db37
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10628
Scan targets checked: none
Failed targets: wolfcrypt-rs-bugs, wolfssl-bugs, wolfssl-src
e08db37 to
dcc4a38
Compare
|
Fix: reject bad lengths before the length math and copy. A |
dcc4a38 to
4a0f10d
Compare
Description
A TLS peer controls the OCSP AIA URI and CRL Distribution Point URI embedded in its certificate. During certificate verification (ProcessPeerCerts → OCSP/CRL lookup), wolfSSL builds an outbound HTTP request to the responder from that attacker-supplied URL. wolfIO_DecodeUrl accepted CR (\r) and LF (\n) bytes in the host and path, and wolfIO_HttpBuildRequest_ex copied them verbatim into the request line and Host: header. A malicious peer could therefore inject arbitrary HTTP headers or split the request on the connection to the OCSP/CRL responder
Addressed by f_4226.
Changes
Testing