curl built with GnuTLS backend defaults to weak crypto parameters
curl built against the GnuTLS backend used the library's NORMAL priority string, which permits weak message-authenticity settings such as small Diffie-Hellman groups. A man-in-the-middle could in principle break the cryptography against a poorly configured server, though the author notes such configurations are rare.
- Disclosed after 38 days
Summary:
Curl configured with GnuTLS backend (--with-gnutls) defaults using "NORMAL" as the base level of the library cryptographic security. From GnuTLS documentation:
The message authenticity security level is of 64 bits or more, and the certificate verification profile is set to GNUTLS_PROFILE_LOW (80-bits),
(Source: https://gnutls.org/manual/html_node/Priority-Strings.html)
As a result the library will allow connections using the weak message authenticity (for example 1024 bit DH group or using DH composite groups).
Note that fortunately it is quite rare to see insecure server configuration that would allow practical exploitation - however it cannot entirely be ruled out, even today.
No AI slop bullshit was used to find this issue or generate the report. Stop the slop!
Affected version
8.16.0 8.17.0-DEV (current master)
Steps To Reproduce:
./configure --with-gnutls; make./src/curl https://dh1024.badssl.com/ https://dh-small-subgroup.badssl.com/ https://dh-composite.badssl.com/
Proposed Fix
The proposed fix is to default to 192bit security by using SECURE192 base level:
Means all the known to be secure ciphersuites that offer a security level 192-bit or more. The message authenticity security level is of 128 bits or more, and the certificate verification profile is set to GNUTLS_PROFILE_HIGH (128-bits).
(Source: https://gnutls.org/manual/html_node/Priority-Strings.html)
Example patch implementing the fix:
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
index c79f192e8..364af7622 100644
--- a/lib/vtls/gtls.c
+++ b/lib/vtls/gtls.c
@@ -315,14 +315,14 @@ static gnutls_x509_crt_fmt_t gnutls_do_file_type(const char *type)
return GNUTLS_X509_FMT_PEM; /* default to PEM */
}
-#define GNUTLS_CIPHERS "NORMAL:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509"
+#define GNUTLS_CIPHERS "SECURE192:-ARCFOUR-128:-CTYPE-ALL:+CTYPE-X509"
/* If GnuTLS was compiled without support for SRP it will error out if SRP is
requested in the priority string, so treat it specially
*/
#define GNUTLS_SRP "+SRP"
#define QUIC_PRIORITY \
- "NORMAL:-VERS-ALL:+VERS-TLS1.3:-CIPHER-ALL:+AES-128-GCM:+AES-256-GCM:" \
+ "SECURE192:-VERS-ALL:+VERS-TLS1.3:-CIPHER-ALL:+AES-128-GCM:+AES-256-GCM:" \
"+CHACHA20-POLY1305:+AES-128-CCM:-GROUP-ALL:+GROUP-SECP256R1:" \
"+GROUP-X25519:+GROUP-SECP384R1:+GROUP-SECP521R1:" \
"%DISABLE_TLS13_COMPAT_MODE"
Supporting Material/References:
Impact
Summary:
- Allowing weak cryptography to poorly configured servers and thus potential attackers in the man-in-the-middle position to break the cryptography.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the GnuTLS backend hard-coded the NORMAL priority string, which sets a low certificate verification profile and a 64-bit message authenticity level, rather than a stricter base level.
Impact
Connections to poorly configured servers could use weak cryptography, letting a man-in-the-middle potentially break it, although the author says such server configurations are rare and practical exploitation cannot entirely be ruled out.
What the attacker needed
Curl built with the GnuTLS backend; server offers weak DH parameters; attacker in man-in-the-middle position
The fix
The default base priority string should be changed from NORMAL to SECURE192 so that only ciphersuites offering 192-bit security or more are accepted.
How it was found
- Build curl from source configured with the GnuTLS backend.
- Run the built curl against the listed weak-DH test hosts.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When two computers set up an encrypted connection, they agree on secret numbers using a mathematical method called Diffie-Hellman. If the numbers used are too small, an attacker sitting in the middle of the connection can work out the secret and read or change the traffic. This report says curl's GnuTLS build accepted such small numbers by default instead of demanding stronger ones.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.