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

0 stars 0 forks source link

transfer of 0 ETH #12

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

gpersoon

Vulnerability details

Impact

The price to mint eventually end up at 0. Assuming this is correct, a price of 0 is transfered to the beneficiary. The just costs gas and does not do anything useful.

Proof of Concept

function getPrice() public view returns (uint) { ... uint elapsed = block.timestamp.sub(saleStartTime); if (elapsed > saleDuration) { return 0; .... }

function mint() external payable reentrancyGuard returns (uint) { ... uint salePrice = getPrice(); ... beneficiary.transfer(salePrice);

Tools Used

Editor

Recommended Mitigation Steps

add an if statement: if (salePrice > 0) beneficiary.transfer(salePrice);