HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Missing Validation for Invalid Position Token in `_redeemPositionToken` Can Lead to Unexpected Behavior

In the _redeemPositionToken function, the contract retrieves pool parameters using getPoolParametersByAddress(_positionToken), which returns a default Pool struct with collateralToken = address(0) if _positionToken is invalid (according to the comments here and its what is actually happening). However, the function does not explicitly check whether _pool.collateralToken is address(0), allowing execution to proceed with an unregistered wToken, which can result in unexpected behavior or failed transactions. The vulnerable code snippet is:

IDIVA.Pool memory _pool = IDIVA(_diva).getPoolParametersByAddress(_positionToken);
// Early check that the pool's collateral token is associated with a registered collateral token.
// This ensures an immediate and graceful revert.
if (_wTokenToCollateralToken[_pool.collateralToken] == address(0)) {
revert CollateralTokenNotRegistered();
}

If an invalid _positionToken is provided, _pool.collateralToken will be address(0), causing _wTokenToCollateralToken[address(0)] to return address(0), leading to a false positive validation instead of reverting. This could result in unexpected behavior when calling _redeemWTokenPrivate, potentially affecting fund safety.

Impact

If an invalid _positionToken is provided, the function will attempt to process an unregistered or nonexistent wToken, leading to incorrect fund withdrawals or transaction failures due to interactions with address(0).

Mitigation

Explicitly check if _pool.collateralToken == address(0) and revert immediately to prevent processing an invalid position token:

if (_pool.collateralToken == address(0)) {
revert InvalidPositionToken();
}
Updates

Lead Judging Commences

bube Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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