sslscan icon indicating copy to clipboard operation
sslscan copied to clipboard

Missing information from XML when certificate not yet valid

Open lucacapacci opened this issue 4 years ago • 5 comments

In sslscan.c, in the "if (options->xmlOutput)" block code related to the not-valid-before (lines 2322-2326) there is no XML reporting about certificate not valid. I would have expected something like the "if (options->xmlOutput)" block code related to the not-valid-after, which in lines 2345-2352 writes in the XML the outcome of the time diff.

lucacapacci avatar Feb 22 '22 16:02 lucacapacci

Are you saying that you'd like the non-XML output say something like "Certificate validity: expired" ?

FYI, expired certificates are already shown to the user in red. See: https://github.com/rbsec/sslscan/blob/3fa40d0a43032c6f0d98248611d515094c63fc15/sslscan.c#L2333

jtesta avatar Feb 23 '22 14:02 jtesta

Hi Joe, nope, I'm afraid I didn't explain the right way. I'm saying that I'd like the XML output say something like <not-yet-valid>true</not-yet-valid> or <not-yet-valid>false</not-yet-valid>.

To be more precise, right now the lines 2322-2326 are these:

if (options->xmlOutput) {
      printf_xml("   <not-valid-before>");
      ASN1_TIME_print(fileBIO, X509_get_notBefore(x509Cert));
      printf_xml("</not-valid-before>\n");
}

I'd like them to be something like this:

if (options->xmlOutput) {
      printf_xml("   <not-valid-before>");
      ASN1_TIME_print(fileBIO, X509_get_notBefore(x509Cert));
      printf_xml("</not-valid-before>\n");
      if (timediff > 0)
      {
          printf_xml("   <not-yet-valid>true</not-yet-valid>\n");
      }
      else
      {
          printf_xml("   <not-yet-valid>false</not-yet-valid>\n");
      }
}

lucacapacci avatar Feb 23 '22 15:02 lucacapacci

Hi @lucacapacci,

Thanks - this looks like a sensible thing to add into the XML. I'm curious though: is this something that you're actually seeing out in the world, and can you share any details about what kind of systems/devices/etc you're seeing it on? I'm not sure I've ever come across this in the wild.

rbsec avatar Feb 23 '22 16:02 rbsec

I think in many years it happened to me just one time and I don't remember the host in which it happened. However, I'm developing an XML parser for sslscan and I thought it would be nice to take into account even these edge cases.

lucacapacci avatar Feb 23 '22 16:02 lucacapacci

Fair enough. I was wondering if there was some vendor out there who was doing this, but if it's just for completeness that makes sense.

rbsec avatar Feb 23 '22 17:02 rbsec