medium

Protocol can break for a token with a proxy and implementation contract (like...

Reward

Total

696.90 USDC

129.06 USDC
129.06 USDC
129.06 USDC
Selected
180.68 USDC
129.06 USDC
Selected Submission

Protocol can break for a token with a proxy and implementation contract (like TUSD)

Severity

High Risk

Relevant GitHub Links

https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DSCEngine.sol#L112

Summary

Tokens whose code and logic can be changed in future can break the protocol and lock user funds.

Vulnerability Details

For a token like TUSD (supported by Chainlink TUSD/USD price feed), which has a proxy and implementation contract, if the implementation behind the proxy is changed, it can introduce features which break the protocol, like choosing to not return a bool on transfer(), or changing the balance over time like a rebasing token.

Impact

Protocol may break in future for this collateral and block user funds deposited as collateral. Also can cause bad loans to be present with no way to liquidate them.

Tools Used

Manual review

Recommendations

  • Developers integrating with upgradable tokens should consider introducing logic that will freeze interactions with the token in question if an upgrade is detected. (e.g. the TUSD adapter used by MakerDAO).
  • OR have a token whitelist which does not allow such tokens.