Moonwell

Moonwell
DeFiFoundry
15,000 USDC
View results
Submission Details
Severity: high
Invalid

Lack of access control in the `MErc20DelegateMadFixer` may result in unauthorized parties draining the contract's funds, leading to financial losses or disruption of protocol operations.

Impact

The sweepAll function in the MErc20DelegateMadFixer contract allows any address to sweep all underlying tokens held by the contract. This lack of access control may result in unauthorized parties draining the contract's funds, leading to financial losses or disruption of protocol operations.

Proof of Concept

/// @title MErc20DelegateMadFixer contract
contract MErc20DelegateMadFixer is MErc20Delegate {
/// @notice sweep underlying tokens
/// @param sweeper address of the sweeper
function sweepAll(address sweeper) external {
/// @dev checks
require(msg.sender == admin, "only admin may sweep all");
EIP20Interface token = EIP20Interface(underlying);
/// @dev take it, take it all
bool success = token.transfer(sweeper, token.balanceOf(address(this)));
require(success, "token sweep failed");
}

The sweepAll function lacks proper access control. The only check performed is to ensure that the caller is the contract admin (msg.sender == admin). However, there are no restrictions beyond this, allowing any address to call the sweepAll function and sweep all underlying tokens held by the contract.

Tools Used

Manual

Recommended Mitigation Steps

To mitigate the risk of unauthorized fund draining, it is recommended to implement proper access control mechanisms in the sweepAll function. Access should be restricted to authorized entities only, such as the contract admin or a designated controller. Additionally, consider implementing withdrawal patterns or time locks to limit the impact of potential attacks and enhance the security of the contract.

Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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