The vulnerability description clearly states that the issue was due to a 'static' variable used to store the selected cipher set in the code for CURLOPT_SSL_CIPHER_LIST when using the Schannel TLS library. The provided commit bbb71507b7bab52002f9b1e0880bed6a32834511 directly addresses this.
-
File lib/vtls/schannel.c:
- The function
set_ssl_ciphers is modified. The key change is the removal of static ALG_ID algIds[45];. This static variable was the root cause of the vulnerability, as its value would be shared across different sessions/transfers.
- The function signature of
set_ssl_ciphers was changed from set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers) to set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers, int *algIds). This change allows algIds to be passed per call, rather than relying on a shared static variable.
- The calling function
schannel_connect_step1 was updated to pass BACKEND->algIds to the modified set_ssl_ciphers function.
-
File lib/vtls/schannel.h:
- The
struct ssl_backend_data was modified to include ALG_ID algIds[NUMOF_CIPHERS];. This ensures that each SSL backend instance has its own storage for cipher IDs, which is then passed to set_ssl_ciphers.
The primary vulnerable function is set_ssl_ciphers because it contained the faulty static variable. The function schannel_connect_step1 is part of the exploitation path as it calls set_ssl_ciphers, but the vulnerability itself (the shared state) resided within set_ssl_ciphers.