[Bug] Integer overflow in EvaluationDomain::reindex_by_subdomain() function #2290
Labels
bug
Something isn't working
does not block mainnet
For when we make decisions that this will not block mainnet.
Summary:
The attacker can trigger integer overflow function EvaluationDomain::reindex_by_subdomain() when using the big input index.
Consider the following branch:
i
is controllable variable (equal toindex - other.size()
). At the same time, there are nousize
bounds checks in the code.Let's consider the case where
other.size() = 1
,self.size() = 2
andindex = usize::MAX / 2 + 2
.In this case
usize
will overflow and the result will be equal to:usize::MAX + 2 = 1
in release buildProof-of-Concept (PoC)
Cargo.toml
src/main.rs
Result (release)
Result (debug)
Impact
The severity of this issue will strongly depend on the use of the function in the code. The issue may lead to DoS and to more serious problems (since the code will not panic in release builds, but will still provide an incorrect result).
The text was updated successfully, but these errors were encountered: