Skip to content

Minerva attack on P-256 in python-ecdsa

High
tomato42 published GHSA-wj6h-64fc-37mp Jan 22, 2024

Package

pip ecdsa (pip)

Affected versions

*

Patched versions

None

Description

Report

Hello python-ecdsa team,

My team and I have tested python-ecdsa and we found that it is vulnerable to the Minerva attack.

The test scenario is that we are signing random messages using the ecdsa.SigningKey.sign_digest() API function. Then using the private key, we extract the K value from the signatures. After that, based on the bit size of the extracted nonce we compare full-sized nonces to smaller ones and use the statistical tests to compare the signature times.

For testing, we used ecdsa package version 0.18.0.

conf_interval_plot_all_k_sizes_median_0-10
In these results, we can clearly see that there is a leak. There is a clear dependency between the bit size of K and the size of the side channel. Each k size takes less and less to be processed. The sample tested has 719,882 observations.

Here you can find more information about the Minerva attack.

For any questions, feel free to contact us.
Hubert Kario @tomato42 <[email protected]>
George Pantelakis <[email protected]>

Reply/Mitigation

Thanks for the report, unfortunately that's the expected result—our scalar multiplication is not constant time.

That means both ECDSA signatures, key generation, and ECDH operations are affected.

ECDSA signature verification is unaffected.

As stated in the security policy side-channel vulnerabilities are outside the scope of the project. Not because we don't want side-channel secure implementation, but because the main goal of the project is to be pure python and implementing side-channel free code in pure python is impossible.

As such, we don't plan to release a fix to this vulnerability.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N

CVE ID

CVE-2024-23342

Credits