<div dir="ltr">Hi Andreas,<div><br></div><div>Thanks for the quick reply.</div><div><br></div><div>Could you point out the code where peer remote cert validation happens for CERT payload?</div><div><br></div><div>Regards,</div><div>Ravi</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 4, 2018 at 2:18 AM, Andreas Steffen <span dir="ltr"><<a href="mailto:andreas.steffen@strongswan.org" target="_blank">andreas.steffen@strongswan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ravi,<br>
<br>
we are not adding received certificates to any trusted cache.<br>
Per default remote certificates are never trusted and are temporarily<br>
added to the auth_cfg object of the IKE_SA. Full X.509 trust chain<br>
verification then happens at a later stage.<br>
<br>
Regards<br>
<br>
Andreas<div class="HOEnZb"><div class="h5"><br>
<br>
On 03.01.2018 14:47, Ravikumar Chennaparapu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
We found an issue with strongswan 5.2.2; peer is accepting CERT payload<br>
even though  digital signature field in CERT payload is tampered.<br>
<br>
As per the below code, there is no validation for the peer's pub key<br>
certificate; peer's public key is added to the cache without any<br>
validation. We do see this as a security vulnerability, could you check<br>
this? Is our understanding correct ?<br>
<br>
<br>
static void process_x509(cert_payload_t *payload, auth_cfg_t *auth,<br>
cert_encoding_t encoding, bool *first)<br>
{<br>
certificate_t *cert;<br>
char *url;<br>
<br>
cert = try_get_cert(payload);<br>
if (cert)<br>
{<br>
if (*first)<br>
{ /* the first is an end entity certificate */<br>
DBG1(DBG_IKE, "received end entity cert \"%Y\"",<br>
cert->get_subject(cert));<br>
auth->add(auth, AUTH_HELPER_SUBJECT_CERT, cert);<br>
*first = FALSE;<br>
}<br>
else<br>
{<br>
DBG1(DBG_IKE, "received issuer cert \"%Y\"",<br>
cert->get_subject(cert));<br>
auth->add(auth, AUTH_HELPER_IM_CERT, cert);<br>
}<br>
}<br>
else if (encoding == ENC_X509_HASH_AND_URL)<br>
{<br>
/* we fetch the certificate not yet, but only if<br>
* it is really needed during authentication */<br>
url = payload->get_url(payload);<br>
if (!url)<br>
{<br>
DBG1(DBG_IKE, "received invalid hash-and-url "<br>
"encoded cert, ignore");<br>
return;<br>
}<br>
url = strdup(url);<br>
if (*first)<br>
{ /* first URL is for an end entity certificate */<br>
DBG1(DBG_IKE, "received hash-and-url for end entity cert \"%s\"",<br>
url);<br>
auth->add(auth, AUTH_HELPER_SUBJECT_HASH_URL, url);<br>
*first = FALSE;<br>
}<br>
else<br>
{<br>
DBG1(DBG_IKE, "received hash-and-url for issuer cert \"%s\"", url);<br>
auth->add(auth, AUTH_HELPER_IM_HASH_URL, url);<br>
}<br>
}<br>
}<br>
<br>
Thanks and Regards,<br>
Ravi<br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
==============================<wbr>==============================<wbr>==========<br>
Andreas Steffen                         <a href="mailto:andreas.steffen@strongswan.org" target="_blank">andreas.steffen@strongswan.<wbr>org</a><br>
strongSwan - the Open Source VPN Solution!          <a href="http://www.strongswan.org" rel="noreferrer" target="_blank">www.strongswan.org</a><br>
Institute for Networked Solutions<br>
University of Applied Sciences Rapperswil<br>
CH-8640 Rapperswil (Switzerland)<br>
==============================<wbr>=============================[<wbr>INS-HSR]==<br>
<br>
</font></span></blockquote></div><br></div>