CVE-2023-28431 Frontier's modexp precompile is slow for even modulus
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.
| Package | Affected | Fixed in |
|---|---|---|
pallet-evm-precompile-modexp crates.io | All versions to 1.0.0 | None |
pallet-evm-precompile-modexp crates.io | All versions to 1.0.0 | None |
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.
Other vulnerabilities in paritytech frontier
- CVE-2023-45130 Frontier opcode SUICIDE touches too many storage values on large contracts
- CVE-2022-36008 Message length overflow in frontier
- CVE-2022-21685 Integer underflow in Frontier
- CVE-2022-39242 Incorrect Calculation in Frontier leads to inflated Ethereum chain gas prices
- CVE-2022-31111 Discrepency in transfer value and actual value due to incorrect truncation in Frontier
Sources
Also known as GHSA-fcmm-54jp-7vf6.