This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
unforgiven - founders vesting allocation doesn't get updated after reservedUntilTokenId gets updated #89
Labels
Non-Reward
This issue will not receive a payout
unforgiven
high
founders vesting allocation doesn't get updated after reservedUntilTokenId gets updated
Summary
function
_addFounders()
use the value of thereservedUntilTokenId
to calculate and set the values for founders vesting allocation, and those vesting are get removed inupdateFounders()
which should be based on thereservedUntilTokenId
value too. the issue is that when the value of thereservedUntilTokenId
is updated, the founders vesting allocation should be calculated again and in current implementation vesting allocation stay based on the old value of thereservedUntilTokenId
which will cause two issue:updateFounders()
based on new value ofreservedUntilTokenId
while allocation is based on old value ofreservedUntilTokenId
.Vulnerability Detail
This is part of the
_addFounders()
code, as you can see it uses the value of thereservedUntilTokenId
to calculate vesting allocations for founders.This is
updateFounders()
code, the vesting allocations which are saved in thetokenRecipient[]
mappings are removed when updating founders. so when removing the vesting allocations, code should use the value of thereservedUntilTokenId
again to calculate vesting allocations an remove them. (currently there is another bug thatbaseTokenId
doesn't start withreservedUntilTokenId
, but to correctly remove the vesting allocations in thetokenRecipient[]
map, code should do exactly like_addFounders()
but instead of setting those slots it should delete those slots)This is
setReservedUntilTokenId()
code, as you can see code doesn't update vesting allocations for founders.so the POC for the issue is:
reservedUntilTokenId
as RUT1.reservedUntilTokenId
and merkle root for reserved tokens. the new value would be RUT2.reservedUntilTokenId
is RUT2 and the vesting allocations are wrong.tokenAllocation[]
mapping because it would calculate those slots based on the RUT2 (if the other bug get fixed) but vesting allocation is still based RUT1.Impact
wrong vesting allocation after
reservedUntilTokenId
changes that is based on old value.wrong vesting allocation causing NFT loss if
updateFounders()
is get called too which creates messy vesting allocation.Code Snippet
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/db232c649b425c36f5a93607c95cfdf0e5962b2f/nouns-protocol/src/token/Token.sol#L411-L427
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/db232c649b425c36f5a93607c95cfdf0e5962b2f/nouns-protocol/src/token/Token.sol#L160-L175
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/db232c649b425c36f5a93607c95cfdf0e5962b2f/nouns-protocol/src/token/Token.sol#L484-L503
Tool used
Manual Review
Recommendation
either update the vesting allocation when
reservedUntilTokenId
changes or make logic of vesting allocation independent of thereservedUntilTokenId
.The text was updated successfully, but these errors were encountered: