xref: /aosp_15_r20/external/curl/docs/SSL-PROBLEMS.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker<!--
2*6236dae4SAndroid Build Coastguard WorkerCopyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard Worker
4*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
5*6236dae4SAndroid Build Coastguard Worker-->
6*6236dae4SAndroid Build Coastguard Worker
7*6236dae4SAndroid Build Coastguard Worker# SSL problems
8*6236dae4SAndroid Build Coastguard Worker
9*6236dae4SAndroid Build Coastguard Worker  First, let's establish that we often refer to TLS and SSL interchangeably as
10*6236dae4SAndroid Build Coastguard Worker  SSL here. The current protocol is called TLS, it was called SSL a long time
11*6236dae4SAndroid Build Coastguard Worker  ago.
12*6236dae4SAndroid Build Coastguard Worker
13*6236dae4SAndroid Build Coastguard Worker  There are several known reasons why a connection that involves SSL might
14*6236dae4SAndroid Build Coastguard Worker  fail. This is a document that attempts to detail the most common ones and
15*6236dae4SAndroid Build Coastguard Worker  how to mitigate them.
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Worker## CA certs
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard Worker  CA certs are used to digitally verify the server's certificate. You need a
20*6236dae4SAndroid Build Coastguard Worker  "ca bundle" for this. See lots of more details on this in the `SSLCERTS`
21*6236dae4SAndroid Build Coastguard Worker  document.
22*6236dae4SAndroid Build Coastguard Worker
23*6236dae4SAndroid Build Coastguard Worker## CA bundle missing intermediate certificates
24*6236dae4SAndroid Build Coastguard Worker
25*6236dae4SAndroid Build Coastguard Worker  When using said CA bundle to verify a server cert, you may experience
26*6236dae4SAndroid Build Coastguard Worker  problems if your CA store does not contain the certificates for the
27*6236dae4SAndroid Build Coastguard Worker  intermediates if the server does not provide them.
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Worker  The TLS protocol mandates that the intermediate certificates are sent in the
30*6236dae4SAndroid Build Coastguard Worker  handshake, but as browsers have ways to survive or work around such
31*6236dae4SAndroid Build Coastguard Worker  omissions, missing intermediates in TLS handshakes still happen that browser
32*6236dae4SAndroid Build Coastguard Worker  users do not notice.
33*6236dae4SAndroid Build Coastguard Worker
34*6236dae4SAndroid Build Coastguard Worker  Browsers work around this problem in two ways: they cache intermediate
35*6236dae4SAndroid Build Coastguard Worker  certificates from previous transfers and some implement the TLS "AIA"
36*6236dae4SAndroid Build Coastguard Worker  extension that lets the client explicitly download such certificates on
37*6236dae4SAndroid Build Coastguard Worker  demand.
38*6236dae4SAndroid Build Coastguard Worker
39*6236dae4SAndroid Build Coastguard Worker## Protocol version
40*6236dae4SAndroid Build Coastguard Worker
41*6236dae4SAndroid Build Coastguard Worker  Some broken servers fail to support the protocol negotiation properly that
42*6236dae4SAndroid Build Coastguard Worker  SSL servers are supposed to handle. This may cause the connection to fail
43*6236dae4SAndroid Build Coastguard Worker  completely. Sometimes you may need to explicitly select a SSL version to use
44*6236dae4SAndroid Build Coastguard Worker  when connecting to make the connection succeed.
45*6236dae4SAndroid Build Coastguard Worker
46*6236dae4SAndroid Build Coastguard Worker  An additional complication can be that modern SSL libraries sometimes are
47*6236dae4SAndroid Build Coastguard Worker  built with support for older SSL and TLS versions disabled.
48*6236dae4SAndroid Build Coastguard Worker
49*6236dae4SAndroid Build Coastguard Worker  All versions of SSL and the TLS versions before 1.2 are considered insecure
50*6236dae4SAndroid Build Coastguard Worker  and should be avoided. Use TLS 1.2 or later.
51*6236dae4SAndroid Build Coastguard Worker
52*6236dae4SAndroid Build Coastguard Worker## Ciphers
53*6236dae4SAndroid Build Coastguard Worker
54*6236dae4SAndroid Build Coastguard Worker  Clients give servers a list of ciphers to select from. If the list does not
55*6236dae4SAndroid Build Coastguard Worker  include any ciphers the server wants/can use, the connection handshake
56*6236dae4SAndroid Build Coastguard Worker  fails.
57*6236dae4SAndroid Build Coastguard Worker
58*6236dae4SAndroid Build Coastguard Worker  curl has recently disabled the user of a whole bunch of seriously insecure
59*6236dae4SAndroid Build Coastguard Worker  ciphers from its default set (slightly depending on SSL backend in use).
60*6236dae4SAndroid Build Coastguard Worker
61*6236dae4SAndroid Build Coastguard Worker  You may have to explicitly provide an alternative list of ciphers for curl
62*6236dae4SAndroid Build Coastguard Worker  to use to allow the server to use a weak cipher for you.
63*6236dae4SAndroid Build Coastguard Worker
64*6236dae4SAndroid Build Coastguard Worker  Note that these weak ciphers are identified as flawed. For example, this
65*6236dae4SAndroid Build Coastguard Worker  includes symmetric ciphers with less than 128 bit keys and RC4.
66*6236dae4SAndroid Build Coastguard Worker
67*6236dae4SAndroid Build Coastguard Worker  Schannel in Windows XP is not able to connect to servers that no longer
68*6236dae4SAndroid Build Coastguard Worker  support the legacy handshakes and algorithms used by those versions, so we
69*6236dae4SAndroid Build Coastguard Worker  advise against building curl to use Schannel on really old Windows versions.
70*6236dae4SAndroid Build Coastguard Worker
71*6236dae4SAndroid Build Coastguard Worker  Reference: [Prohibiting RC4 Cipher
72*6236dae4SAndroid Build Coastguard Worker  Suites](https://datatracker.ietf.org/doc/html/draft-popov-tls-prohibiting-rc4-01)
73*6236dae4SAndroid Build Coastguard Worker
74*6236dae4SAndroid Build Coastguard Worker## Allow BEAST
75*6236dae4SAndroid Build Coastguard Worker
76*6236dae4SAndroid Build Coastguard Worker  BEAST is the name of a TLS 1.0 attack that surfaced 2011. When adding means
77*6236dae4SAndroid Build Coastguard Worker  to mitigate this attack, it turned out that some broken servers out there in
78*6236dae4SAndroid Build Coastguard Worker  the wild did not work properly with the BEAST mitigation in place.
79*6236dae4SAndroid Build Coastguard Worker
80*6236dae4SAndroid Build Coastguard Worker  To make such broken servers work, the --ssl-allow-beast option was
81*6236dae4SAndroid Build Coastguard Worker  introduced. Exactly as it sounds, it re-introduces the BEAST vulnerability
82*6236dae4SAndroid Build Coastguard Worker  but on the other hand it allows curl to connect to that kind of strange
83*6236dae4SAndroid Build Coastguard Worker  servers.
84*6236dae4SAndroid Build Coastguard Worker
85*6236dae4SAndroid Build Coastguard Worker## Disabling certificate revocation checks
86*6236dae4SAndroid Build Coastguard Worker
87*6236dae4SAndroid Build Coastguard Worker  Some SSL backends may do certificate revocation checks (CRL, OCSP, etc)
88*6236dae4SAndroid Build Coastguard Worker  depending on the OS or build configuration. The --ssl-no-revoke option was
89*6236dae4SAndroid Build Coastguard Worker  introduced in 7.44.0 to disable revocation checking but currently is only
90*6236dae4SAndroid Build Coastguard Worker  supported for Schannel (the native Windows SSL library), with an exception
91*6236dae4SAndroid Build Coastguard Worker  in the case of Windows' Untrusted Publishers block list which it seems cannot
92*6236dae4SAndroid Build Coastguard Worker  be bypassed. This option may have broader support to accommodate other SSL
93*6236dae4SAndroid Build Coastguard Worker  backends in the future.
94*6236dae4SAndroid Build Coastguard Worker
95*6236dae4SAndroid Build Coastguard Worker  References:
96*6236dae4SAndroid Build Coastguard Worker
97*6236dae4SAndroid Build Coastguard Worker  https://curl.se/docs/ssl-compared.html
98