Security: TLS client does not verify server hostname #189
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: medium
Category: security
Location:
src/shared/transport_tls.c:134-161Description:
client_connect_tls()sets up SSL verification when a CA is provided (SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL)), but it never callsSSL_set1_host()orSSL_set_verify()with hostname verification. An attacker with a valid certificate forevil.com(signed by the configured CA) can impersonate the intended servermyserver.example.com.Suggested fix:
After creating the SSL object and before
SSL_connect(), set the expected hostname:Verify the result with
SSL_get_verify_result(ssl)after the handshake and check that hostname verification succeeded. Alternatively, callSSL_verify_client_post_handshake()semantics or inspect the peer certificate.Labels: security, tls