Expired certificate is trusted

Abierto
#1,130 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
android, java, kotlin
Área
security

Línea de trabajo

Comienza leyendo la delegación de RootTrustManager de Android a TrustManagerImpl de Conscrypt, especialmente cómo se utiliza la variable trustAnchors durante la validación de la cadena de certificados. Aclara si un certificado expirado colocado explícitamente en un KeyStore debe seguir considerándose de confianza, documenta el comportamiento esperado y verifícalo con un escenario centrado de SSL-engine usando la configuración de SSLContext mostrada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I have the following kotlin code, which is executed in android application (which in turn uses Conscrypt under the hood):

val expiredCertificate: X509Certificate = ...
val keyStore = KeyStore.getInstance(KeyStore.getDefaultType())
putCert(keyStore, expiredCertificate)
val trustManagerFactory = TrustManagerFactory.getInstance(algorithm).apply {
    init(keyStore)
}
val trustManager = trustManagerFactory.trustManagers.firstOrNull() as? X509TrustManager
val sslContext = SSLContext.getInstance("TLS").apply {
    init(null, arrayOf(trustManager), SecureRandom())
}

In short:

  1. I get (no matter how) expired x509-certificate,
  2. put it in KeyStore,
  3. pass the store to SslContext as store of trusted certificates,
  4. now my ssl-engine (or conscrypt-engine which is the same) has trustStore with expired certificate,
  5. next, I initiate ssl-connection with backend and receive server`s certificate chain with this exact certificate that resides in trust store.

The question is: upon validating the chain, should conscrypt-engine check expiration of received certificate? On the one hand, the certificate is trusted (resides in trust store thus is trust anchor), on the other hand, it is expired. Should conscrypt-engine trust the certificate or not?

P.S. The behaviour I actually observe is the following: the certificate is handled with android.security.net.config.RootTrustManager which delegates to com.android.org.conscrypt.TrustManagerImpl which puts my certificate to a variable with self-explanatory name trustAnchors and does not perform any checks so that my expired certificate is trusted. I wonder whether this is bug or feature.

Lenguaje dominante
Java
Estrellas
1.4k
Forks
332
Merge medio
2 d 56 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de google/conscrypt

Todos los issues de google/conscrypt

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.