DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: low
Invalid

Improper Use of Current Block Timestamp as Swap Deadline in claimAndSwap Function

Summary

The claimAndSwap function uses a keeper-provided deadline equal to the current block timestamp, which introduces potential security risks and could lead to worse execution prices.

Vulnerability Details

In the claimAndSwap function, the IVeloRouter's swapExactTokensForTokens call sets the deadline parameter to the current block timestamp:

IVeloRouter(router).swapExactTokensForTokens(
_amount,
minOut,
_path,
address(this),
block.timestamp // Using current block as deadline
);

This implementation allows transactions to remain pending in the mempool and be executed in subsequent blocks. This delay can expose the transaction to front-running or sandwich attacks. Although the minOut parameter offers some level of protection, relying solely on it may not be sufficient in all scenarios.

Impact

An attacker or arbitrage bot could exploit the delayed execution caused by the current block deadline to manipulate token prices, resulting in unfavorable swap rates for users. This exposes the protocol to sandwich attacks, where attackers profit from the user's transaction while users receive suboptimal execution prices.

Tools Used

Slither, Manual Review

Recommendations

  • Use a Future Deadline: Replace block.timestamp with a future timestamp (e.g., block.timestamp + 300) to allow a reasonable buffer for transaction execution.

  • Monitor Mempool Activity: Implement additional checks to detect unusual transaction activity or delays.

  • Strengthen minOut Calculations: Ensure the minOut parameter is set conservatively to reduce the impact of unfavorable price changes.

  • Gas Price Management: Use optimized gas price strategies to ensure swift transaction inclusion in blocks, minimizing mempool delay.Improper Use of Current Block Timestamp as Swap Deadline in claimAndSwap Function

Updates

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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