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.
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:
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.
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.
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.
Vscode
Manual Review
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:
2.Emergency Pausing Mechanism: Introduce an emergency pause mechanism to suspend all critical operations and prevent token approvals during a security incident.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.