Expired certificate is trusted

オープン
#1,130 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
android, java, kotlin
領域
security

調査の方向性

まず、Android の RootTrustManager から Conscrypt の TrustManagerImpl への委譲を読み、特に証明書チェーンの検証中に変数 trustAnchors がどのように使用されるかを確認します。KeyStore に明示的に配置された期限切れの証明書を引き続き信頼すべきかを明確にし、期待される動作を文書化したうえで、示されている SSLContext セットアップを使用した焦点を絞った SSL-engine シナリオで検証します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
1.4k
フォーク
332
平均マージ
2日 56分
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

google/conscrypt のほかの issue

google/conscrypt の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。