Paranoid プロジェクトは、公開鍵、デジタル署名、一般的な疑似乱数などの暗号成果物に存在する既知の脆弱性を検査します。このライブラリには、文献で見られる既存の研究の実装と最適化が含まれています。既存の研究は、これらの成果物の生成が一部のケースで欠陥があったことを示しました。以下は、このライブラリの基となった出版物の例です。
目的は、Google の内外における暗号のユースケースに対する信頼性を高めることです。
非対称暗号を扱う場合、暗号成果物は通常次のいずれかです:
Paranoid を使えば、あらゆる暗号成果物をテストできますが、その主な動機は、脆弱なサードパーティ製ハードウェアやソフトウェアのブラックボックスの使用を検出することです。したがって、Paranoid はソースコードを検査できない場合(上記 3. の状況)でも使用できます。
このプロジェクトは、既知の脆弱性だけでなく未知の脆弱性の検出も目指しています。例えば、プログラミングエラーや脆弱な独自の乱数生成器の使用によって引き起こされる脆弱性を特定しようとします。新しい脆弱性の検出は、当然ながら既知の脆弱性の検出よりもはるかに困難です。そのような検出には、大規模な成果物の集合が必要となるか、低い確率でしか脆弱なものを発見できない場合があります。
そのため、脆弱な暗号成果物を生成した暗号ライブラリについてのフィードバックや情報提供を非常に歓迎しています(call for contributions を参照)。このプロジェクトは常に進行中です。脆弱な実装について学んだ後は、それらを分析し、それらを対象とした検出を追加する計画です。
現在実装されているチェックのドキュメントは docs にあります。ドキュメントは時間の経過とともにさらに内容が追加される予定です。
チェックの使用方法を知るには、examples フォルダまたはユニットテスト(*test.py ファイル)を参照してください。examples では、さまざまな暗号成果物のテスト方法が示されています。
リポジトリをクローンします:
$ git clone https://github.com/google/paranoid_crypto.git && cd paranoid_crypto
NOTE: The commands below have been tested on Debian stable version
(bookworm). Make sure you will be using python3.11 or newer.
Install dependencies:
$ sudo apt update && sudo apt install python3 python3-full python3-pip \
python3-pybind11 python3-fpylll python3-gmpy2 libgmp-dev protobuf-compiler
Create and activate a virtual environment:
$ python3 -m venv --system-site-packages ~/paranoid-venv
$ source ~/paranoid-venv/bin/activate
NOTE: If you know what you are doing, you can instead skip to the next step
and use --break-system-packages switch for pip.
Install paranoid_crypto python package:
$ python3 -m pip install .
インストールが成功したかどうかを確認するには、ユニットテストを実行できます。 例えば、次のとおりです。
$ cd paranoid_crypto && python3 -m unittest discover -b -p "*test.py"
.................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 305 tests in 314.660s
OK
あるいは、コンテナ内で実行したい場合は、以下に示すように提供されている Dockerfile を使用できます。
注意: docker が インストールされていることを確認してください。
リポジトリをクローンした後、Docker イメージをビルドします:
$ docker build -t paranoid-img .
Create and start the container:
$ docker run --name paranoid-container -it paranoid-img
paranoid-user@6191368b26b8:~$
To check whether the installation was successful, you can run the unit tests. For example:
paranoid-user@6191368b26b8:~$ cd paranoid_crypto && python3 -m unittest discover -b -p "*test.py"
.................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 305 tests in 307.555s
OK
Similar to other published works, we have been analyzing the crypto artifacts from Certificate Transparency (CT), which logs issued website certificates since 2013 with the goal of making them transparent and verifiable. Its database contains more than 7 billion certificates as of September 2022. For the Paranoid checks of EC public keys and ECDSA signatures, so far, we have not found any weak artifacts in CT. For the RSA public key checks with severities high or critical, we have the following results:
| TestName | Potentially Related CVEs | Severity | Number of Weak Artifacts |
|---|---|---|---|
| CheckOpensslDenylist | CVE-2008-0166 | SEVERITY_CRITICAL | 3989 |
| CheckROCA | CVE-2017-15361 | SEVERITY_HIGH | 2875 |
| CheckGCD | - | SEVERITY_CRITICAL | 1860 |
| CheckFermat | CVE-2022-26320 | SEVERITY_CRITICAL | 36 |
| CheckContinuedFractions | - | SEVERITY_CRITICAL | 16 |
| CheckBitPatterns | - | SEVERITY_CRITICAL | 6 |
| CheckPermutedBitPatterns | - | SEVERITY_CRITICAL | 6 |
| CheckKeypairDenylist | CVE-2021-41117 | SEVERITY_CRITICAL | 4 |
| CheckPollardpm1 | - | SEVERITY_CRITICAL | 1 |
Some of these certificates were already expired or revoked. For the ones that were still active (most of the CheckGCD ones), we immediately reported them to the Certificate Authorities to be revoked.
This library is developed and maintained by members of Google Security Team, but this is not an officially supported Google product. If you want to contribute, please read CONTRIBUTING and send us pull requests. You can also report bugs or file feature requests.
If you use Paranoid in your research, you can cite it using the following BibTeX:
@software{Barbosa_Bleichenbacher_Paranoid_Crypto_2022,
author = {Barbosa, Pedro and Bleichenbacher, Daniel},
license = {Apache-2.0},
month = {8},
title = {{Paranoid Crypto}},
url = {https://github.com/google/paranoid_crypto},
year = {2022}
}