DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Invalid

Invalid Route Number Access in router.exchange

Vulnerability Details

The function does not validate _routeNumber before accessing the mappings routes, swapParams, and pools. If _routeNumber > nRoutes, the mappings will return default values, such as address(0) for addresses and 0 for integers, potentially leading to an invalid transaction.

Impact

Passing invalid parameters to router.exchange can cause the transaction to revert or execute with unintended behavior, leading to wasted gas or protocol disruption.

Proof of Concept

router.exchange(
routes[_routeNumber], // Could return address(0)
swapParams[_routeNumber], // Could return default 0 values
_amountClaim, _minOut, pools[_routeNumber], // Could return address(0)
address(this)
);

Tools Used

Manual code review.

Recommended Mitigation Steps

Add a validation check to ensure _routeNumber is within the valid range:

require(_routeNumber < nRoutes, "Invalid route number");
Updates

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.