Moonwell

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

Any attacker can call sensitive functions like `sweepAll`. Posesing a risk of unauthorized modifications or misuse of the contract's functionality, potentially leading to financial losses.

Summary

The MIP-MI17.sol contract lacks proper access control measures, allowing any address to call sensitive functions like sweepAll. This vulnerability poses a risk of unauthorized modifications or misuse of the contract's functionality, potentially leading to financial losses or disruptions in protocol operations.

Vulnerability Details

The sweepAll function is publicly accessible, meaning any address can call it without restriction. This lack of access control allows unauthorized users to sweep all underlying tokens from the contract to their address, bypassing any intended restrictions or permissions.

POC

Creating an hypothetical scenario to illustrate the vulnerability:

// illustrate the lack of proper access control
contract MIPM17Mock {
address public admin;
address public sweeper;
constructor() {
admin = msg.sender;
}
// Function to set the sweeper address
function setSweeper(address _sweeper) external {
sweeper = _sweeper;
}
// Vulnerable function lacking proper access control
function sweepAll() external {
// No access control check implemented
// Anyone can call this function and sweep all tokens
require(msg.sender == sweeper, "only sweeper may sweep all");
// Sweeping logic...
}
}

Impact

  • Unauthorized users can exploit the sweepAll function to transfer all underlying tokens from the contract to their address.

  • This could result in significant financial losses for the protocol and its users if a malicious actor gains access to the function and drains the contract's funds.

  • Additionally, unauthorized modifications or misuse of the contract's functionality can disrupt protocol operations and undermine user trust.

Tools Used

Manual

Recommendations

  1. Implement access control measures to restrict sensitive functions like sweepAll to authorized users only.

  2. Use role-based access control (RBAC) or permissioned roles to grant specific privileges to trusted addresses while preventing unauthorized access.

  3. Regularly review and update access control mechanisms to adapt to changing security requirements and address emerging threats.

  4. Consider implementing a timelock or multisig mechanism for critical operations to add an additional layer of security and oversight.

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.