Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: low
Invalid

Security Vulnerability: Lack of SafeApprove in USDT Token Transfers

Summary

The lack of using safeApprove() in the FeeDistributionBranch::convertAccumulatedFeesToWeth function exposes the protocol to potential security risks when interacting with tokens like USDT that do not return a boolean value on approval. The function currently uses the approve() method to approve token transfers, but this can lead to issues where the approval fails silently or is manipulated, as USDT does not provide feedback on the success or failure of the approval. This creates a potential for failed token swaps, unintended over-approvals, and vulnerabilities to reentrancy attacks. By not using safeApprove(), the contract lacks the necessary safeguards to ensure secure and predictable approval behavior, especially when interacting with certain tokens. Replacing approve() with safeApprove() would mitigate these risks and improve the security of the protocol.

Vulnerability Details

// Original code with potential vulnerability
IERC20(asset).approve(dexSwapStrategy.dexAdapter, ctx.assetAmount);

Impact

The use of approve instead of safeApprove in the convertAccumulatedFeesToWeth function can lead to the following issues:

  1. Unreliable Approval Handling:

    • In token contracts like USDT, the approve function does not return a boolean value to confirm that the approval was successful. If the approval fails for any reason (e.g., insufficient allowance or an issue with the token contract), the contract will not be able to detect it, potentially leading to failed transactions when attempting to swap tokens. This could cause unexpected behavior or revert errors.

Tools Used

Recommendations

// Mitigated code using safeApprove
IERC20(asset).safeApprove(dexSwapStrategy.dexAdapter, ctx.assetAmount);
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!