MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: high
Invalid

wrap in WStETHMock.sol vulnerable to reentrancy

Summary

wrap in WStETHMock.sol vulnerable to reentrancy

Vulnerability Details

Inside wrap() ,minting of stETHAmount_ amount of tokens is happening first and afterwards the stETHAmount_ amount of tokens are transferred from msg.sender to the contract address thus creating a re-entrancy attack.

function wrap(uint256 stETHAmount_) external returns (uint256) {
require(stETHAmount_ > 0, "wstETH: can't wrap zero stETH");
_mint(msg.sender, stETHAmount_);
stETH.transferFrom(msg.sender, address(this), stETHAmount_);
return stETHAmount_;
}

Impact

Complete depletion of the token balance within the contract.

Tools Used

Manual Review

Recommendations

First Transfer tokens to contract and then mint the amount of tokens to msg.sender.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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