CVE-2023-28431 Frontier's modexp precompile is slow for even modulus

High 7.5 Published Updated

Attackers can cause denial of service in Frontier by exploiting slow even-modulus calculations in the modexp precompile due to unaccounted gas costs.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2023-28431?

CVE-2023-28431 is a high-severity denial of service vulnerability in paritytech frontier, published on 22 Mar 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Frontier is an Ethereum compatibility layer for Substrate. Frontier's `modexp` precompile uses `num-bigint` crate under the hood. In the implementation prior to pull request 1017, the cases for modulus being even and modulus being odd are treated separately. Odd modulus uses the fast Montgomery multiplication, and even modulus uses the slow plain power algorithm. This gas cost discrepancy was not accounted for in the `modexp` precompile, leading to possible denial of service attacks.

No fixes for `num-bigint` are currently available, and thus this issue is fixed in the short term by raising the gas costs for even modulus, and in the long term fixing it in `num-bigint` or switching to another modexp implementation. The short-term fix for Frontier is deployed at pull request 1017. There are no known workarounds aside from applying the fix.

Weakness: CWE-682

Which versions are affected by CVE-2023-28431?

2 open source packages ship an affected version, including pallet-evm-precompile-modexp. It affects 1 product.

PackageAffectedFixed in
pallet-evm-precompile-modexp crates.ioAll versions to 1.0.0None
pallet-evm-precompile-modexp crates.ioAll versions to 1.0.0None

Products include Parity Frontier.

How do I fix CVE-2023-28431?

No fix has been published for CVE-2023-28431 yet. Limit exposure of the affected software until one is available.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2023-28431 being exploited?

There is no known exploitation of CVE-2023-28431 in the wild and no public exploit code.

Sources

Also known as GHSA-fcmm-54jp-7vf6.

Is CVE-2023-28431 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free