15,000 USDC
View results
Submission Details
Severity: low
Valid

No input validation for "collateral" address

Summary

There is no input validation for "collateral" address in the external function liquidate().

Vulnerability Details

The liquidate() function in the DSCEngine.sol smart contract can be called with any address as the "collateral" address. However, doing so while creating the priceFeed object at line 344 will cause the transaction to be reverted.

[https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/d1c5501aa79320ca0aeaa73f47f0dbc88c7b77e2/src/DSCEngine.sol#L344]

AggregatorV3Interface priceFeed = AggregatorV3Interface(s_priceFeeds[token]);

Impact

When the function "liquidate()" is invoked with a non-collateral address, the transaction will be reverted.

Tools Used

Manual Review

Recommendations

Adding "isAllowedToken(collateral)" modifer to "liquidate()" function

Updates

Lead Judging Commences

adadadsadaxxx Auditor
over 1 year ago

Support

FAQs

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