Expired certificate is trusted

Aperta
#1,130 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
android, java, kotlin
Ambito
security

Direzione di ricerca

Inizia leggendo la delega di RootTrustManager di Android a TrustManagerImpl di Conscrypt, in particolare il modo in cui la variabile trustAnchors viene utilizzata durante la convalida della catena di certificati. Chiarisci se un certificato scaduto inserito esplicitamente in un KeyStore debba rimanere considerato attendibile, quindi documenta il comportamento previsto e verificalo con uno scenario SSL-engine mirato che utilizzi la configurazione SSLContext mostrata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Java
Stelle
1.4k
Fork
332
Merge medio
2g 56m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/conscrypt

Tutte le issue di google/conscrypt

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.