This issue pertains to the burn and burnFrom methods. These methods have been restricted using the onlyRole(BURNER_ROLE) modifier. However, a crucial oversight exists where the BURNER_ROLE has not been initialized either in the contract's constructor or any other part of the contract. As a result, these methods are effectively inaccessible due to the missing role assignment.
Proof of Concept
The two functions are restricted to BURNER_ROLE, but the role was never set.
function burn(
uint256 _amount
) public override(ERC20Burnable, IDpxEthToken) onlyRole(BURNER_ROLE) {
_burn(_msgSender(), _amount);
}
function burnFrom(
address account,
uint256 amount
) public override onlyRole(BURNER_ROLE) {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
Tools Used
Manual review.
Recommended Mitigation Steps
set the BURNER_ROLE in the constructor just like the other roles.
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/dpxETH/DpxEthToken.sol#L19-L26
Vulnerability details
Impact
This issue pertains to the
burn
andburnFrom
methods. These methods have been restricted using theonlyRole(BURNER_ROLE)
modifier. However, a crucial oversight exists where the BURNER_ROLE has not been initialized either in the contract's constructor or any other part of the contract. As a result, these methods are effectively inaccessible due to the missing role assignment.Proof of Concept
The two functions are restricted to BURNER_ROLE, but the role was never set.
Tools Used
Manual review.
Recommended Mitigation Steps
set the BURNER_ROLE in the constructor just like the other roles.
Assessed type
Access Control