HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

[M-01] Lack of Revocation for Unlimited Token Approvals to Aave V3 Pool

Summary

The _approveCollateralTokenForAave function grants unlimited token allowances to the Aave V3 Pool contract during the registration of a collateral token or through manual approval. However, the contract does not provide any mechanism to revoke or reduce these approvals. This introduces a significant security risk in the event that the DIVA Protocol or Aave V3 Pool contract becomes compromised, potentially enabling malicious actors to drain funds from the contract.

Vulnerability Details

The issue stems from the _approveCollateralTokenForAave function, which sets an unlimited allowance for collateral tokens. Once the approval is granted, there is no function available in the contract to revoke or reduce this allowance. This oversight is particularly concerning in the following scenarios:

  1. Protocol Compromise: If Aave or DIVA Protocol is compromised, malicious actors can exploit the unlimited approval to transfer the entire balance of collateral tokens from the contract.

  2. Collateral Token Exploits: If the underlying ERC20 token (e.g., USDC, USDT) contains vulnerabilities, the unlimited approval increases the exposure to such vulnerabilities.

This lack of an emergency mechanism leaves the contract and its users vulnerable to potentially significant losses.

Vulnerable code

Impact

The inability to revoke token approvals can result in a complete loss of funds held in the contract, depending on the severity of a potential compromise. This issue undermines the security of the contract and increases the risk of cascading failures across the ecosystem in which the contract operates.

Tools Used

  • Vscode

  • Manual Review

Recommendations

  1. Add Revocation Functionality: Implement a function that allows the owner to revoke or reduce token approvals for Aave V3 or other protocols when necessary. This function should:

  • Set the allowance to zero for the specified collateral token.

  • Be callable only by the contract owner or an authorized administrator.

Example:

function revokeApprovalForAave(address _collateralToken) external onlyOwner {
IERC20Metadata(_collateralToken).safeApprove(_aaveV3Pool, 0);
}

2.Emergency Pausing Mechanism: Introduce an emergency pause mechanism to suspend all critical operations and prevent token approvals during a security incident.

Updates

Lead Judging Commences

bube Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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