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 in OpenSSL #23860

Open
GeorgePantelakis opened this issue Mar 15, 2024 · 2 comments
Open

Minerva attack in OpenSSL #23860

GeorgePantelakis opened this issue Mar 15, 2024 · 2 comments
Assignees
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 epic Body of work that has to be broken down into more manageably sized issues triaged: bug The issue/pr is/fixes a bug

Comments

@GeorgePantelakis
Copy link

GeorgePantelakis commented Mar 15, 2024

@tomato42 and I have tested OpenSSL 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.

In our initial test, we found side-channels in curves P-256, P-364, and P-521. 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. For initial testing, we used the master checkout from 2023-09-11.

conf_interval_plot_p256_trim_mean_45
The sample tested has 107,970,608 observations.

conf_interval_plot_p384_trim_mean_45
The sample tested has 43,179,504 observations.

conf_interval_plot_p521_trim_mean_45
The sample tested has 97,170,890 observations. The results for P-521 are notable due to the big "step" present between results for 512-bit and 513-bit nonces, which is over 250ns.

After long cooperation with the OpenSSL team, we have arrived at a patch that significantly reduces leakage for P-256 and P-384 signing operations.

For P-521, with the patch applied, the "step" of 25ns is still present between the 512-bit and 513-bit nonce, but no side channel in larger nonce sizes.

final_conf_interval_p521_trim_mean_45
The sample tested has 58,312,456 observations.

@GeorgePantelakis GeorgePantelakis added the issue: bug report The issue was opened to report a bug label Mar 15, 2024
@beldmit beldmit 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 and removed issue: bug report The issue was opened to report a bug labels Mar 15, 2024
@tomato42
Copy link
Contributor

tomato42 commented Mar 15, 2024

One more thing, while we don't have evidence that it's immediately exploitable, as the selected nonce is created by OpenSSL internally, there is one rather contrived scenario where it is exploitable over the network with OpenSSL 3.2.0:

  • the network-accessible service needs to sign verbatim attacker-controlled messages
  • the service needs to use the newly added deterministic ECDSA implementation

this way the attacker will be able to determine if the deterministically selected nonce is short or not, and use that information for solving the Hidden Number Problem.

Given that most services like that will actually sign the attacker provided message with some kind of timestamp (think time-stamping protocol), or combine the attacker controlled data with server controlled data, in effect making the exact signed messages not repeatable, the attack against deterministic ECDSA is mostly theoretical.

@t8m t8m self-assigned this Apr 18, 2024
@nhorman nhorman added the epic Body of work that has to be broken down into more manageably sized issues label Apr 29, 2024
@tomato42
Copy link
Contributor

tomato42 commented May 9, 2024

related:
#24317
#24252
#24253
#24254
#24274

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 epic Body of work that has to be broken down into more manageably sized issues triaged: bug The issue/pr is/fixes a bug
Projects
Status: Refine
Development

Successfully merging a pull request may close this issue.

5 participants