Description
Different comments around CVE-2020-25659 (like in #6167 and #5507) state that the fix is incomplete and documentation (https://cryptography.io/en/latest/limitations/#rsa-pkcs1-v1-5-constant-time-decryption) specifies that PKCS#1 v1.5 encryption padding is vulnerable to side-channel attacks.
I'm filing this issue with the evidence that this is a confirmed fact, not just an assertion based on code analysis.
While I've executed it with python3-cryptography-3.2.1-6.el8.x86_64, python36-3.6.8-38.module+el8.5.0+12207+5c5719bc.x86_64, and openssl-1.1.1k-10.el8_9 both the cryptography package has the CVE-2020-25659 fix and openssl has the CVE-2022-4304 fix.
The test was executed with 2048 bit RSA, with 100k repeats per probe, in a VM on a fairly noisy/busy 2.3GHz Icelake Xeon system.
The measured side channel is about 400ns, so it should be fairly easy to exploit even over remote network connections.
analysis.py summary:
tlsfuzzer analyse.py version 5 analysis
Sign test mean p-value: 0.3447, median p-value: 0.1886, min p-value: 2.459e-13
Friedman test (chisquare approximation) for all samples
p-value: 8.947806111025913e-27
Worst pair: 1(no_header_with_payload_48), 6(valid_48)
Mean of differences: -5.35165e-07s, 95% CI: -1.51931e-06s, 4.859572e-07s (±1.003e-06s)
Median of differences: -4.50001e-07s, 95% CI: -5.85012e-07s, -3.309875e-07s (±1.270e-07s)
Trimmed mean (5%) of differences: -5.91658e-07s, 95% CI: -9.38480e-07s, -2.549461e-07s (±3.418e-07s)
Trimmed mean (25%) of differences: -5.80887e-07s, 95% CI: -7.53559e-07s, -4.100913e-07s (±1.717e-07s)
Trimmed mean (45%) of differences: -4.75457e-07s, 95% CI: -6.04405e-07s, -3.463844e-07s (±1.290e-07s)
Trimean of differences: -6.01688e-07s, 95% CI: -8.09003e-07s, -3.924847e-07s (±2.083e-07s)
Results for comparisons between individual samples are in the report.csv
Graphical representation of the confidence intervals of the difference between different classes to class 0:
mapping numbers to classes is in legend.csv
explanation of the ciphertexts generated is in the step2.py script.
You can reproduce this results using the script and instructions in https://github.com/tomato42/marvin-toolkit/tree/master/example/pyca-cryptography