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

`ERC20Burnable` token have `burnFrom()` function

Summary

ERC20Burnable token have burnFrom() function. And the DecentralizedStableCoin is ERC20Burnable, and the mint() and burn() function have the onlyOwner modifier. Therefore, the DecentralizedStableCoin should be designed so that it cannot be mint or burn by the user at will. But the burnFrom() can be called directly by the user.So I think this violates the design principle, and this will affect the correctness of the s_DSCMinted parameter

Vulnerability Details

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Burnable.sol
As we can see , the ERC20Burnable.sol have the burnFrom()

function burnFrom(address account, uint256 value) public virtual {
_spendAllowance(account, _msgSender(), value);
_burn(account, value);
}

And the mint() and burn() function have the onlyOwner modifier.
https://github.com/Cyfrin/2023-07-foundry-defi-stablecoin/blob/main/src/DecentralizedStableCoin.sol#L39

Impact

I think this violates the design principle, and this will affect the correctness of the s_DSCMinted parameter

Tools Used

vs code

Recommendations

Add onlyOwner modifier to burnFrom()

Support

FAQs

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