Incorrect Withdraw Pattern #408
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
invalid
This doesn't seem right
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-08-nounsdao/blob/c1c7c6201d0247f92472419ff657b570f9104565/contracts/governance/NounsDAOLogicV2.sol#L783-L792
Vulnerability details
Context:
NounsDAOLogicV2.sol#L783-L792
Description:
1 -When we transfer ether with
call
, we have to check (with require) whether the bool value will be successful.This part is missing in the code in the contractProof Of Concept: https://solidity-by-example.org/sending-ether/
2- Since the bool value is not checked with require, the value value in "emit" will be recorded with an incorrect value, as if the transfer was successful, even if there is no ether transfer.
3-
call
in combination with re-entrancy guard is the recommended method to use after December 2019.Proof Of Concept: https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/
4- This can be unsafe if the private key for the owner account falls into the wrong hands, allowing instant withdrawal of all the funds. In general, having a single point of failure like this is not recommended best practice .See this example where a similar finding has been flagged as a high-severity issue
Proof Of Concept: code-423n4/2021-08-realitycards-findings#73
Recommendation:
The text was updated successfully, but these errors were encountered: