When ca_path is NULL (no --ca flag), SSL_CTX_set_verify is never called, meaning OpenSSL default is SSL_VERIFY_NONE. The client will:
Accept any certificate presented by the server
Be vulnerable to MITM attacks
Not validate the server identity at all
Additionally, the server never requests client certificates even when CA is set — only SSL_VERIFY_PEER is used server-side, but without SSL_VERIFY_FAIL_IF_NO_PEER_CERT, unauthenticated clients can still connect.
Fix: When --ca is provided, always set SSL_VERIFY_PEER on the client side. Consider setting SSL_VERIFY_FAIL_IF_NO_PEER_CERT for server when CA is provided.
Severity: critical
In `src/shared/transport_tls.c`, `create_ssl_ctx()` only enables peer certificate verification when a CA path is specified:
**Lines 66-75:**
```c
if (ca_path) {
if (!SSL_CTX_load_verify_locations(ctx, ca_path, NULL)) { ... }
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
SSL_CTX_set_verify_depth(ctx, 4);
}
```
When `ca_path` is NULL (no `--ca` flag), `SSL_CTX_set_verify` is never called, meaning OpenSSL default is `SSL_VERIFY_NONE`. The client will:
1. Accept any certificate presented by the server
2. Be vulnerable to MITM attacks
3. Not validate the server identity at all
Additionally, the server never requests client certificates even when CA is set — only `SSL_VERIFY_PEER` is used server-side, but without `SSL_VERIFY_FAIL_IF_NO_PEER_CERT`, unauthenticated clients can still connect.
**Fix:** When `--ca` is provided, always set `SSL_VERIFY_PEER` on the client side. Consider setting `SSL_VERIFY_FAIL_IF_NO_PEER_CERT` for server when CA is provided.
**Severity:** critical
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
In
src/shared/transport_tls.c,create_ssl_ctx()only enables peer certificate verification when a CA path is specified:Lines 66-75:
When
ca_pathis NULL (no--caflag),SSL_CTX_set_verifyis never called, meaning OpenSSL default isSSL_VERIFY_NONE. The client will:Additionally, the server never requests client certificates even when CA is set — only
SSL_VERIFY_PEERis used server-side, but withoutSSL_VERIFY_FAIL_IF_NO_PEER_CERT, unauthenticated clients can still connect.Fix: When
--cais provided, always setSSL_VERIFY_PEERon the client side. Consider settingSSL_VERIFY_FAIL_IF_NO_PEER_CERTfor server when CA is provided.Severity: critical