The vulnerability CVE-2024-8096 states that curl, when using GnuTLS for OCSP stapling, might incorrectly consider a certificate fine if the OCSP status reports an error other than 'revoked' (e.g., 'unauthorized').
The introducing commit (f13669a375f) added OCSP support in lib/vtls/gtls.c. The function gtls_connect_step3 implemented the check using gnutls_ocsp_status_request_is_checked(). If this function did not return 0 (indicating a problem or 'not good' status), an else branch was taken which logged 'SSL server certificate status verification OK' and proceeded. This else branch is the vulnerable path if gnutls_ocsp_status_request_is_checked() incorrectly returned 1 (good) for an OCSP error like 'unauthorized'.
The fixing commit (aeb1a281cab) modified the function Curl_gtls_verifyserver in the same file. It removed the old logic based on gnutls_ocsp_status_request_is_checked() and replaced it with a more robust check that explicitly fetches the OCSP status details (gnutls_ocsp_status_request_get, gnutls_ocsp_resp_import, gnutls_ocsp_resp_get_single) and then fails if the status is anything other than GNUTLS_OCSP_CERT_GOOD.
Both gtls_connect_step3 (where the vulnerable logic was introduced) and Curl_gtls_verifyserver (where the vulnerable logic was present and then fixed) are identified as vulnerable. The core issue was the misinterpretation or insufficient handling of the return value from gnutls_ocsp_status_request_is_checked(), leading to an incorrect 'OK' status for certain OCSP errors.