PDA

Bekijk Volledige Versie : authentication bug in KAME's racoon



Thomas Walpuski
15/06/04, 10:35
Summary

There is a severe bug in racoon's authentication via digital
signatures with certificates.

Description

racoon verifies the peer's certificate using eay_check_x509cert().
For some strange reason eay_check_x509cert() sets a verify callback:

X509_STORE_set_verify_cb_func(cert_ctx, cb_check_cert);

Verify callbacks are usually used for debugging purpose. Take a look
at what racoon uses the verify callback for:

static int
cb_check_cert(ok, ctx)
int ok;
X509_STORE_CTX *ctx;
{
char buf[256];
int log_tag;

if (!ok) {
[..]
switch (ctx->error) {
case X509_V_ERR_CERT_HAS_EXPIRED:
case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
#if OPENSSL_VERSION_NUMBER >= 0x00905100L
case X509_V_ERR_INVALID_CA:
case X509_V_ERR_PATH_LENGTH_EXCEEDED:
case X509_V_ERR_INVALID_PURPOSE:
#endif
ok = 1;
log_tag = LLV_WARNING;
break;
default:
log_tag = LLV_ERROR;
}
[..]
}
ERR_clear_error();

return ok;
}

If OpenSSL fails on verifying the certificate, because it is expired,
self-signed, signed by an inappropriate CA, not allowed for that
purpose or the certificate chain is too long, racoon does not care
about that and declares the verification successful. I dare to say
that is brain dead.

Affected Systems

All version of racoon known to me are vulnerable.

Impact

IMO besides remote privilege escalation that is the worst case
scenario for an IKE daemon.

Solution?

There are no bug fixes, yet. I recommend not using racoon at all.

Thomas Walpuski

Michal Ludvig
15/06/04, 21:55
On Mon, 14 Jun 2004, Thomas Walpuski wrote:

> If OpenSSL fails on verifying the certificate, because it is expired,
> self-signed, signed by an inappropriate CA, not allowed for that
> purpose or the certificate chain is too long, racoon does not care
> about that and declares the verification successful. I dare to say
> that is brain dead.

Next time you may dare to contact the developers first...

Anyway, the linux port of racoon distributed in the IPsec-tools package
(http://ipsec-tools.sourceforge.net) is fixed. The new version is
IPsec-tools 0.3.3 and can be downloaded here:
http://sourceforge.net/project/showfiles.php?group_id=74601&package_id=74949&release_id=245982

Currently it only allows (but still warns) that CRL for the cert is
unavailable for certificates obtained from the IKE payload. All other
problems are treated as errors and ISAKMP negotiation fails.

For locally available certs (via peers_certfile statement) the rules are
more relaxed and because the certificate can be trustfully verified it is
allowed that it is expired, self-signed or "for other puropse". The
verification still succeeds but emits a warning.

Vendors are encouraged to update their packages.

Regards,

Michal Ludvig
--
* A mouse is a device used to point at the xterm you want to type in.
* Personal homepage - http://www.logix.cz/michal

Thomas Walpuski
17/06/04, 02:05
* Michal Ludvig wrote:
> Next time you may dare to contact the developers first...

The last time I wanted to contact the KAME developers privately I got
no answer at all. Five months later I published the issue on BugTraq and
KAME replied in less then 12 hours.

Thomas Walpuski

Michal Ludvig
18/06/04, 06:55
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 15 Jun 2004, Thomas Walpuski wrote:

> * Michal Ludvig wrote:
> > Next time you may dare to contact the developers first...
>
> The last time I wanted to contact the KAME developers privately I got
> no answer at all. Five months later I published the issue on BugTraq and
> KAME replied in less then 12 hours.

The linux port of racoon which uses essentially the same codebase (though
ported to linux and a extended with new features) has it's own mailing
lists:

For "normal" bugreports use: ipsec-tools-devel@lists.sourceforge.net
Security ones should go to: ipsec-tools-core@lists.sourceforge.net

Thanks,

Michal Ludvig
- --
* A mouse is a device used to point at the xterm you want to type in.
* Personal homepage - http://www.logix.cz/michal
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQFA0Vz4DDolCcRbIhgRAhAyAJ4jeKetVRives6ADeUPJa JMMP9jiACg1Aui
cv6KOcBwqb3uoYQAOdvVRzM=
=YzdD
-----END PGP SIGNATURE-----