First Flight #18: T-Swap

First Flight #18
Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: medium
Invalid

Reentrancy Vulnerability in TSwapPool Contract

Summary

Ensure that all state changes are done before any external calls (like token transfers in this case). Although SafeERC20 is used, which mitigates some risks, it's still good practice to follow the checks-effects-interactions pattern.

Vulnerability Details

Reentrancy vulnerabilities occur when an external contract is called before all internal state changes are completed, allowing the external contract to call back into the original function and potentially exploit the incomplete state. Even though the SafeERC20 library is used, which reduces the risk of reentrancy, it is still crucial to follow the checks-effects-interactions pattern to ensure the contract's security.

Impact

  • Draining funds from the contract

  • Manipulating contract state

Tools Used

Manual Inspection

Recommendations

To prevent reentrancy attacks, it is essential to follow the checks-effects-interactions pattern, which involves:

  1. Checks: Verify conditions before making any state changes or external calls.

  2. Effects: Make all necessary state changes.

  3. Interactions: Call external contracts only after state changes are completed.

Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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