Full Disclosure mailing list archives

possible backdoor in OpenSSL X509 verification


From: Arnis <arnis () ut ee>
Date: Fri, 06 Sep 2013 17:28:34 +0300

Can someone take a look on this shady X.509 certificate verification code
(fails open in case of out-of-memory error):

http://rt.openssl.org/Ticket/Display.html?id=2924

"Certificate chain verification in crypto/x509/x509_vfy.c
X509_verify_cert() fails badly and may allow verification bypass if
check_issued() on line 259 returns false negative on check whether the last
certificate in chain is self signed. For example, check_issued() may
return false negative in case of memory allocation failure (although could
not find how to force that).

253 /* Examine last certificate in chain and see if it
254 * is self signed.
255 */
256
257 i=sk_X509_num(ctx->chain);
258 x=sk_X509_value(ctx->chain,i-1);
259 if (ctx->check_issued(ctx, x, x))

This is because "for" loop later does not require to find even a single
issuer certificate from trust store and will happily break loop if last
certificate is actually self signed."


Noone from OpenSSL team has commented whether this is exploitable or
should it be rewritten in safer manner.

P.S. Subject field inspired by latest NSA stories ;)

_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.grok.org.uk/full-disclosure-charter.html
Hosted and sponsored by Secunia - http://secunia.com/


Current thread: