According to the intended role of the host, they should be able to withdraw all the Ether and tokens in the contract. However, the withdraw
function is currently transferring only the tokens, leaving all the native Ether within the contract. This prevents the host from withdrawing any Ether as expected.
This vulnerability prevents the host from withdrawing native ETH from the contract. In a scenario where 80% of the funds are transferred as native ETH, the host would be unable to access these funds. As a result, the host would need to use their own money to cover the expenses required to conduct the event.
The below code is the POC
Add the above code in ChristmasDinnerTest.t.sol:ChristmasDinnerTest
shell forge test --match-test test_POC_Host_Unable_To_Withdraw_Native_Eth -vv
You will get output as following
Starting Natie ETH Balance of deployer : 0
Starting USDC Balance of deployer : 0
Starting WETH Balance of deployer : 0
Starting WBTC Balance of deployer : 0
Ending Natie ETH Balance of deployer : 0
Ending USDC Balance of deployer : 6000000000000000000
Ending WETH Balance of deployer : 6000000000000000000
Ending WBTC Balance of deployer : 6000000000000000000
Native ETH balance in ChristmasDinner after withdraw by host : 13000000000000000000
Foundry
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.