Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instead of call() , transfer() is used to withdraw the ether #2

Open
code423n4 opened this issue Apr 29, 2021 · 0 comments
Open

instead of call() , transfer() is used to withdraw the ether #2

code423n4 opened this issue Apr 29, 2021 · 0 comments
Labels
2 (Med Risk) bug Something isn't working

Comments

@code423n4
Copy link
Contributor

Handle

JMukesh

Vulnerability details

Impact

function withdraw(uint amount) external {
require(amount <= ethBalance[msg.sender]);
ethBalance[msg.sender] = ethBalance[msg.sender].sub(amount);
msg.sender.transfer(amount);
emit Withdraw(msg.sender, amount);
}

To withdraw eth it uses transfer(), this trnansaction will fail inevitably when : -

  1. The withdrwer smart contract does not implement a payable function.

  2. Withdrawer smart contract does implement a payable fallback which uses more than 2300 gas unit

  3. Thw withdrawer smart contract implements a payable fallback function whicn needs less than 2300 gas unit but is called through proxy that raise the call's gas usage above 2300

https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/

Proof of Concept

https://github.com/code-423n4/2021-04-redacted/blob/main/Beebots.sol#L649

Tools Used

no tool used

Recommended Mitigation Steps

use call() to send eth

@code423n4 code423n4 added bug Something isn't working 2 (Med Risk) labels Apr 29, 2021
code423n4 added a commit that referenced this issue Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 (Med Risk) bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant