User can get 2^192-1 votes #201
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
Lines of code
https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/lib/token/ERC721Votes.sol#L179-L190
https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/lib/token/ERC721Votes.sol#L179-L190
Vulnerability details
Impact
By taking advantage of 2 bugs a user can get themselves 2^192-1 votes.
This amount of voting gives the user ability to pass or defeat any proposal.
In the best case scenario, it bricks the DAO and makes it ineffective, locking in funds.
In the worst case scenario it allows the user to pass a proposal to drain all the funds.
Proof of Concept
The 2 bugs are:
delegate
function the user's voting power is not decreased_afterTokenTransfer
the votes are moved from the NFT owners instead of from their delegatesThe steps needed to take advantage of this:
Forge test showing the issue:
Tools Used
Manual review
Recommended Mitigation Steps
Fix bug 1 by changing:
address prevDelegate = delegation[_from];
to:
address prevDelegate = delegates(_from);
Fix bug 2 by changing:
_moveDelegateVotes(_from, _to, 1);
to:
_moveDelegateVotes(delegates(_from), delegates(_to), 1);
The text was updated successfully, but these errors were encountered: