Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: low
Invalid

The withdrawal function uses `transfer` instead of `call` to transfer ETH, this can lead to loss of funds for smart contract accounts

Summary

When withdrawing and ETH, the TokenManager.sol contract uses Solidity’s transfer() function.

Vulnerability Details

Using Solidity's transfer() function has some notable shortcomings when the withdrawer is a smart contract, making ETH deposits impossible to withdraw. Specifically, the withdrawal will inevitably fail when:

  • The withdrawer smart contract does not implement a payable fallback function.

  • The withdrawer smart contract implements a payable fallback function that uses more than 2300 gas units.

  • The withdrawer smart contract implements a payable fallback function that needs less than 2300 gas units but is called through a proxy that raises the call’s gas usage above 2300.

https://github.com/Cyfrin/2024-08-tadle/blob/main/src/core/TokenManager.sol#L169

payable(msg.sender).transfer(claimAbleAmount);

Impact

Loss of Funds because withdrawal will fail

Tools Used

Manual Analysis

Recommendations

Use call instead of transfer.

- payable(msg.sender).transfer(claimAbleAmount);
+ payable(msg.sender).call(claimAbleAmount);
Updates

Lead Judging Commences

0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

[invalid] finding-TokenManager-withdraw-transfer-2300-gas

Invalid, known issues [Medium-2](https://github.com/Cyfrin/2024-08-tadle/issues/1)

Support

FAQs

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