SSL handshake failed through a proxy

An intercepting proxy runs two TLS handshakes: with the app and with the server. How to tell which one failed, and what to fix in each case.

Two handshakes instead of one

A proxy that decrypts HTTPS splits one TLS handshake in two: app ↔ proxy, where it presents a certificate signed by its root CA, and proxy ↔ server, where it is the client. The error message tells which side failed: SSL handshake with client failed or SSL handshake with server failed.

If the handshake with the client failed

The app rejected the proxy's certificate. The TLS alert it sent is usually in the error:

Alert Code What it means
unknown_ca 48 The proxy's root certificate is not installed or not trusted
certificate_unknown 46 Unspecified rejection: Java and Android send it for an untrusted CA as well as for pinning
certificate_expired 45 The certificate expired, or the client's clock is wrong
bad_certificate 42 The certificate is malformed or its signature does not verify
no alert, just a drop — The app closed the connection silently: pinning or its own CA store

The codes are defined in RFC 8446 § 6.

Check in order:

  1. The certificate is installed and trusted. A browser on the same computer opens the site without a warning. If not, see ERR_CERT_AUTHORITY_INVALID.

  2. The app has its own CA store. Add the proxy's root there:

    # Java 9+
    keytool -importcert -cacerts -alias debug-proxy -file proxy-ca.pem
    
    # Node.js
    export NODE_EXTRA_CA_CERTS=/path/to/proxy-ca.pem
    
    # Python requests
    export REQUESTS_CA_BUNDLE=/path/to/bundle-with-proxy-ca.pem
    
    # curl
    curl --cacert proxy-ca.pem https://api.example.com

    keytool asks for the store password, changeit by default. REQUESTS_CA_BUNDLE replaces the whole CA list, so the file must hold the usual roots as well as the proxy's.

  3. An Android app does not trust user CAs. It needs a network_security_config: see Android does not trust the proxy certificate.

  4. Pinning. One or two hosts fail while the rest decrypt. No setting gets around a built-in list: exclude the host from decryption.

If the handshake with the server failed

  • mTLS. The server wants a client certificate, and the proxy has none. In TLS 1.3 the server may answer certificate_required (116). Give the proxy the client certificate, if it supports that, or exclude the host.
  • The proxy rejects the server's certificate: a staging server with a self-signed or expired certificate and strict validation on. Turn it off while you debug.
  • No common TLS version or cipher, e.g. a server limited to TLS 1.0.
  • An antivirus or corporate proxy between the proxy and the server. See proxies and VPNs.

Checking without the app

Repeat the connection through the proxy:

openssl s_client -connect api.example.com:443 \
  -proxy 127.0.0.1:7070 -servername api.example.com \
  -CAfile proxy-ca.pem

curl -v -x http://127.0.0.1:7070 https://api.example.com

In the openssl output the issuer line should be the proxy's CA. Verify return code: 0 (ok) means the chain verifies against -CAfile. Without that flag OpenSSL checks its own CA bundle, not the macOS keychain or the Windows store.

See it on your own traffic

Solpuga records a request that got no response with the reason: "the TLS handshake with the client failed" or "the server rejected the proxy's TLS connection", plus the underlying error. Strict TLS validation of server certificates is off by default. Add a host with pinning or mTLS to Settings → SSL Proxying → Bypass list: its traffic stays in the recording, without decryption. Details: Capture & Inspect Traffic.

View in Solpuga

Related