-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
(As I've sent to the security mailing list three emails, last one over 2 weeks ago, and haven't received anything but automated reply that the email was received, I'm making the issue public here. What follows after the question is a verbatim copy of the last email.)
Question: Should I ask for CVE assignment for it?
I've tested both PKCS#1 v1.5 and OAEP API and verified that both provide
a clear side-channel signal useful in Bleichenbacher-like attacks.
Since my previous emails have received nothing but an automated reply
for over a week, I'll be making this issue in BouncyCastle public in
two weeks (on 6th of November) if that doesn't change.
I've tested bcprov-jdk18on-17.jar on OpenJDK 1.8.0_372 from ArchLinux on
an AMD Ryzen 5 5600X CPU. I did not perform any special tuning to
make the noise smaller.
I've used the test harnesses in attachment to run the test data generated
by the step2-alt.sh and step2-oaep-alt.sh from
https://github.com/tomato42/marvin-toolkit/
(though I did test just 2048 bit keys, not the 1024 and 4096 generated by
them too).
Both of them accept 3 parameters: a path to a RSA PKCS#8 DER key, path to
a file with concatenation of RSA ciphertexts (they both assume those are 256
bytes long), and an output csv file where timing of the processing will be
written. See the examples/pyca-cryptography in the above repo on how to
process that csv file further.
For both padding modes the Friedman test p-value is smaller than what
a double precision floating point number can represent (i.e. it's reported
as 0).
That's in spite of using just 10k and 100k sample size for pkcs1 and oaep
test respectively.
Which means the timing signal is extremely strong and definitely exploitable
over the network.
Looking more closely at the results, it's clear that the PKCS#1 interface
leaks timing data through raising of an exception, and the OAEP interface leaks timing data through the bit size of the decrypted value (EM in PKCS#1
nomenclature). Though those are very imprecise results, additional
side-channels may be present.
See the Marvin paper for suggestions how to fix this:
https://people.redhat.com/~hkario/marvin/
A bit more information is also present in the draft specifying the
RSA implicit rejection mechanism I'm working to standardise:
https://github.com/tomato42/marvin-ietf
See step2.py for explanation of the meaning of the probes, the legend for
pkcs1.png is as follows:
ID,Name
0,header_only
1,no_header_with_payload_48
2,no_padding_48
3,no_structure
4,signature_padding_0
5,valid_0
6,valid_48
7,valid_192
8,valid_246
9,valid_repeated_byte_payload_246_1
10,valid_repeated_byte_payload_246_255
11,zero_byte_in_padding_48_4
for oaep.png is as follows:
ID,Name
0,no_padding_48
1,no_structure
2,signature_padding_0
3,too_short_payload_0_1
4,too_short_payload_0_3
5,too_short_payload_0_7
6,too_short_payload_0_15
7,valid_0
8,valid_repeated_byte_payload_245_0
pairwise sign test and Wilcoxon signed rank test results are in the csv files:
oaep.csv
pkcs1.csv

