Repository navigation
Conversation
With an anonymous cipher suite the server sends no certificate. wolfSSL then completes the handshake and neither WOLFSSL_VERIFY_PEER nor wolfSSL_check_domain_name() has anything to check, so curl accepted the connection even with CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST enabled. Only the IP address path checked for a missing certificate. wolfSSL builds with HAVE_ANON and OPENSSL_COMPATIBLE_DEFAULTS, such as --enable-distro, offer anonymous suites by default. Require a peer certificate whenever verifypeer or verifyhost is set.
There was a problem hiding this comment.
🟡 Changes recommended
Automated regression coverage is needed for certificate-less handshakes across verification-option combinations.
1 open issue
What changed in this PR
This PR closes a wolfSSL certificate-verification bypass for anonymous TLS connections in curl.
Changes:
- Requires a peer certificate when either peer or hostname verification is enabled.
- Preserves the existing IP-address certificate check.
| File | Description |
|---|---|
| lib/vtls/wolfssl.c | Extends the missing-certificate check beyond IP-address connections. |
Review effort: Balanced
Comment on lines
1721
to
+1722
| if(ret == WOLFSSL_SUCCESS && | ||
| conn_config->verifyhost && | ||
| !connssl->peer.sni) { | ||
| /* we have an IP address as hostname. */ | ||
| (conn_config->verifypeer || conn_config->verifyhost)) { |
Member
|
Thanks! |
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.

With an anonymous cipher suite the server sends no certificate. wolfSSL then completes the handshake and neither WOLFSSL_VERIFY_PEER nor wolfSSL_check_domain_name() has anything to check, so curl accepted the connection even with CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST enabled. Only the IP address path checked for a missing certificate.
This moves the missing certificate check out of the IP address block so it runs whenever verifypeer or verifyhost is set. The IP match check is unchanged.
Tested with wolfSSL 5.9.4 (--enable-distro) and 5.6.6: an anonymous DH server is now refused with CURLE_PEER_FAILED_VERIFICATION, CA signed servers by hostname and IP, TLS 1.2 and 1.3 and session resumption work as before, HTTPS/FTPS tests pass