Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minerva attack on OpenSSL built without enable-ec_nistp_64_gcc_128 #24274

Open
GeorgePantelakis opened this issue Apr 26, 2024 · 7 comments
Open
Labels
branch: master Merge to master branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 branch: 3.2 Merge to openssl-3.2 branch: 3.3 Merge to openssl-3.3 inactive triaged: bug The issue/pr is/fixes a bug

Comments

@GeorgePantelakis
Copy link

@tomato42 and I have tested OpenSSL built without the enable-ec_nistp_64_gcc_128 option on Configure and we found that it may be vulnerable to a variant of the Minerva attack. We used statistical analysis to confirm the presence of side channels but we did not perform the Minerva attack against the implementation.

In the test scenario, we measure the time of signing of random messages using the EVP_DigestSign API (Init, Update, and Final) and then use the private key to extract the K value (nonce) from the signatures. Then based on the bit size of the extracted nonce we compare the signing time of full-sized nonces to signatures that used smaller nonces using statistical tests.

We have verified that for P-256, this path uses the nistz256 implementation and calls the ecp_nistz256_points_mul() function. The test used OpenSSL from HEAD on 2024-04-12.

We found a side-channel in P-256 on non-determinist OpenSSL. In these results we can see a clear leak: there is a dependency between the bit size of K and the size of the side channel.

conf_interval_plot_all_k_sizes_trim_mean_45_0-10
The results for P-256 non-deterministic path. Skilling-Mack test p-value: 0. The sample tested has 507,469,447 observations.

conf_interval_plot_all_k_sizes_trim_mean_45_0-10
The results for P-384 non-deterministic path. Skilling-Mack test p-value: 2.528827e-54. The sample tested has 518,259,886 observations.

conf_interval_plot_all_k_sizes_trim_mean_45_0-10
The results for P-521 non-deterministic path. Skilling-Mack test p-value: 1.318966e-256. The sample tested has 518,253,832 observations.

@GeorgePantelakis GeorgePantelakis added the issue: bug report The issue was opened to report a bug label Apr 26, 2024
@GeorgePantelakis GeorgePantelakis changed the title Minerva attack on building OpenSSL without enable-ec_nistp_64_gcc_128 Minerva attack on OpenSSL built without enable-ec_nistp_64_gcc_128 Apr 26, 2024
@t8m t8m added branch: master Merge to master branch triaged: bug The issue/pr is/fixes a bug branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 branch: 3.2 Merge to openssl-3.2 branch: 3.3 Merge to openssl-3.3 and removed issue: bug report The issue was opened to report a bug labels Apr 26, 2024
@t8m
Copy link
Member

t8m commented Apr 26, 2024

@GeorgePantelakis I assume all these results were obtained with the nonce fixes from #24265

If you build with enable-ec_nistp_64_gcc_128 you should see the same leak on P-256 as it will also use the nistz256 implementation.

@GeorgePantelakis
Copy link
Author

@t8m No because when we ran this we didn't even have the patch for deterministic, we only had the non-deterministic fixes. In general, it used the HEAD git checkout of 2024-04-12. The non-deterministic path, which was tested, was fixed then so it shouldn't show a signal, but it does. Anyway, we are currently running the test again with the changes from #24265. If there is a signal in the new results I will close it as fixed with the fixed results.

@nhorman
Copy link
Contributor

nhorman commented Jun 5, 2024

ping, @GeorgePantelakis is there an update here with the fixes from #24265 ? Please update, otherwise I'll assume its fixed and close at the end of the 3.4 dev cycle (october 14)

@GeorgePantelakis
Copy link
Author

GeorgePantelakis commented Jun 6, 2024

Hello,

sorry for this late response. So for this with the fixes looks good, it took a great amount of time to gather the data and still, we cannot confirm the complete absence of side channels. What we have is that P-256 seems safe and for P-384 and P-521 there isn't a side channel bigger than 2ns for the first k-sizes. Also, the 512-513 step of P-521 seems to be less than 15ns. To confirm the absence of a side channel will take more time and data.

conf_interval_plot_all_k_sizes_trim_mean_45_0-10
The results for P-256 non-deterministic path. The sample tested has 658,614,707 observations.

conf_interval_plot_all_k_sizes_trim_mean_45_0-10
The results for P-384 non-deterministic path. The sample tested has 939,379,680 observations.

conf_interval_plot_all_k_sizes_trim_mean_45_0-10
The results for P-384 non-deterministic path. The sample tested has 855,790,612 observations.

cc @tomato42

@nhorman
Copy link
Contributor

nhorman commented Jun 6, 2024

@GeorgePantelakis thank you. So where does that leave us? My instinct is to call this particular issue resolved, and have you open a new issue if your further testing reveals additional timing leakage. Or would you prefer to leave this issue open until you complete the remaining testing? If the latter, do you have an estimate on when those results will be complete?

@GeorgePantelakis
Copy link
Author

@nhorman I would suggest keeping it open at least over the weekend to run some final tests and if we got no luck or if we found no problem then we can close it.

@nhorman
Copy link
Contributor

nhorman commented Jun 6, 2024

ACK, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: master Merge to master branch branch: 3.0 Merge to openssl-3.0 branch branch: 3.1 Merge to openssl-3.1 branch: 3.2 Merge to openssl-3.2 branch: 3.3 Merge to openssl-3.3 inactive triaged: bug The issue/pr is/fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants