<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>


<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<p class="details" style="font-style: italic; color: #777;">
<a href="https://gitlab.com/Immortalem">Immortalem</a> created an issue <a href="https://gitlab.com/gnutls/gnutls/-/issues/1031">#1031</a>:
</p>
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">During client certificate authentication (Tested in TLS 1.0 to 1.2) GnuTLS accepts certificate chains in which the intermediate CA certificate has no key usage extension. However, the specification for X.509 certificates, <a href="https://tools.ietf.org/html/rfc5280#section-4.2.1.3" rel="nofollow noreferrer noopener" target="_blank">RFC 5280</a>, states regarding the Key Usage extension that "Conforming CAs MUST include this extension in certificates that contain public keys that are used to validate digital signatures on other public key certificates or CRLs.  When present, conforming CAs SHOULD mark this extension as critical."</p>
<p dir="auto">I think that this constraint should be enforced by libraries through checking that the extension is present and contains the correct values.</p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">3.6.13, 3.6.14</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">Compiled from source after cloning the respective branch from GitHub</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto">Steps to Reproduce:</p>
<ul dir="auto">
<li>Start <code>gnutls-serv</code> with
<ul>
<li>
<a href="https://gitlab.com/gnutls/gnutls/uploads/220bbfd19bdf074125362a1b8227885b/ROOTv3_CAv3_LEAF_RSAv3__leaf_certificate1.pem" data-link="true" class="gfm">ROOTv3_CAv3_LEAF_RSAv3__leaf_certificate1.pem</a> for <code>--x509certfile</code>
</li>
<li>
<a href="https://gitlab.com/gnutls/gnutls/uploads/8d6df42f84649152d9ecd12ba17b944b/rsakey_2.pem" data-link="true" class="gfm">rsakey_2.pem</a> for <code>--x509keyfile</code>
</li>
<li>
<a href="https://gitlab.com/gnutls/gnutls/uploads/5539c2945e90e9be1bc0bdb53253fd31/root.pem" data-link="true" class="gfm">root.pem</a> for <code>--x509cafile</code>
</li>
<li>require client certificate <code>-r</code>
</li>
<li>verify client certificate <code>--verify-client-cert</code>
</li>
</ul>
</li>
<li>Use OpenSSL <code>s_client</code> or similar tool to connect to the server using the following two certificates. This example uses OpenSSL.
<ul>
<li><code>openssl s_client -connect localhost:4433 -cert ROOTv3_CAv3_NoKeyUsage_LEAF_RSAv3__leaf_certificate1.pem -key rsakey_2.pem -CAfile ROOTv3_CAv3_NoKeyUsage_LEAF_RSAv3__ca_certificate1.pem</code></li>
<li><a href="https://gitlab.com/gnutls/gnutls/uploads/72b83e9d76b2e152571c1b3da1a69de0/ROOTv3_CAv3_NoKeyUsage_LEAF_RSAv3__leaf_certificate1.pem" data-link="true" class="gfm">ROOTv3_CAv3_NoKeyUsage_LEAF_RSAv3__leaf_certificate1.pem</a></li>
<li><a href="https://gitlab.com/gnutls/gnutls/uploads/a4e19e4cc801e03e4a6c8785d13c1a6f/ROOTv3_CAv3_NoKeyUsage_LEAF_RSAv3__ca_certificate1.pem" data-link="true" class="gfm">ROOTv3_CAv3_NoKeyUsage_LEAF_RSAv3__ca_certificate1.pem</a></li>
<li><a href="https://gitlab.com/gnutls/gnutls/uploads/8d6df42f84649152d9ecd12ba17b944b/rsakey_2.pem" data-link="true" class="gfm">rsakey_2.pem</a></li>
</ul>
</li>
</ul>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<p dir="auto">GnuTLS accepts the certificate chain and proceeds with the handshake.</p>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">GnuTLS should reject the certificate chain since the CA certificate is invalid. Consequently, the handshake should be aborted.</p>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/issues/1031">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/d71ec880c2a319020062874418a3afda/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/-/issues/1031"}}</script>


</p>
</div>
</body>
</html>