GNU security library GnuTLS fails on cert checks: Patch now
Many eyes missed bug for many years
The notion that open source software is more likely to be secure because anyone can look at the source code looks just a little less sound today, after a serious bug was discovered in the key GnuTLS security library, impacting hundreds of applications that use it.
According to this Red Hat advisory: “It was discovered that GnuTLS did not correctly handle certain errors that could occur during the verification of an X.509 certificate, causing it to incorrectly report a successful verification. An attacker could use this flaw to create a specially crafted certificate that could be accepted by GnuTLS as valid for a site chosen by the attacker.”
As a result, a certificate could be accepted as valid even though it wasn't issued by a trusted CA – for example, an attacker could merely self-sign a bogus certificate.
It's down to bad “goto cleanup” calls, similar to Apple's recent “goto fail” SSL bug. There's no causal relationship between the two: goto has been fingered as a problem in software languages ever since Edsger Dijkstra's famous “goto considered harmful” letter of 1968 (there's an annotated version of the letter here).
One commenter in this Reddit thread says the bug is nearly a decade old, having crept into the code back in 2005.
As is noted on this Hacker News thread, alternative security libraries such as OpenSSL are available and packages can be compiled against OpenSSL rather than GnuTLS. However, as a result of license incompatibilities, plenty of packages default to GnuTLS.
The bug was discovered by Nikos Mavrogiannopoulos of the Red Hat Security Technologies Team. ®