Логотип exploitDog
Консоль
Логотип exploitDog

exploitDog

github логотип

GHSA-fcmm-54jp-7vf6

Опубликовано: 21 мар. 2023
Источник: github
Github: Прошло ревью
CVSS3: 7.5

Описание

Frontier's modexp precompile is slow for even modulus

Impact

Frontier's modexp precompile uses num-bigint crate under the hood. In the implementation, 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.

Patches

No fixes for num-bigint is currently available, and thus this advisory will be first 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 PR 1017.

The recommendations are as follows:

  • If you anticipate malicious validators, it's recommended to issue an emergency runtime upgrade as soon as possible.
  • If you do not anticipate malicious validators, it's recommended to issue a normal runtime upgrade, as Substrate has builtin timeout protection when validators are building blocks.

Workarounds

None.

References

A similar issue was presented in Geth's implementation and the fix can be found here.

Пакеты

Наименование

pallet-evm-precompile-modexp

rust
Затронутые версииВерсия исправления

<= 1.0.0

Отсутствует

EPSS

Процентиль: 50%
0.00265
Низкий

7.5 High

CVSS3

Дефекты

CWE-682

Связанные уязвимости

CVSS3: 7.5
nvd
почти 3 года назад

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.

EPSS

Процентиль: 50%
0.00265
Низкий

7.5 High

CVSS3

Дефекты

CWE-682