The _redeem_collateral() internal function does not validate that the token_collateral_address is a registered collateral token before attempting the redemption.
While _deposit_collateral() properly checks self.token_address_to_price_feed[token_collateral_address] != empty(address), the redemption function lacks this validation.
This inconsistency means the function relies solely on the user having a non-zero balance for that token, which could lead to unexpected behavior if an invalid token address is passed.
Likelihood: Low
Reason 1 // Requires user to somehow have balance for unregistered token
Reason 2 // Current flow makes this unlikely since deposits are validated
Impact: Low
Impact 1 // Inconsistent validation between deposit and redeem
Impact 2 // Could cause confusion or unexpected reverts
Impact 3 // Defense-in-depth principle violated
The following demonstrates the inconsistency in validation between deposit and redeem functions. While the current flow protects against this since deposits are validated, the asymmetric validation creates potential for bugs if the code is modified in the future.
Add the same token validation check to _redeem_collateral() for consistency and defense-in-depth. This ensures both deposit and redemption paths validate the token address, making the code more robust against future modifications.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.