code-423n4 / 2021-04-meebits-findings

0 stars 0 forks source link

transfer used #13

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

gpersoon

Vulnerability details

Impact

The transfer function is used to transfer ETH.

However it is recommended to use "call" https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/

Proof of Concept

function mint() external payable reentrancyGuard returns (uint) { ... if (msg.value > salePrice) { msg.sender.transfer(msg.value.sub(salePrice)); } beneficiary.transfer(salePrice);

function withdraw(uint amount) external {
    ...
    msg.sender.transfer(amount);

Tools Used

Recommended Mitigation Steps

Consider using the following construction instead: (bool success, / bytes memory response/) = msg.sender.call{value: amount}(''); require(success, "Pay was not successful.");