This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
updateFounders
, the computation of owner's reserved token indices is different from that in _addFounders
, resulting the old founders not be completely removed.
#288
ydlee
high
In
updateFounders
, the computation of owner's reserved token indices is different from that in_addFounders
, resulting the old founders not be completely removed.Summary
In
updateFounders
, the computation of owner's reserved token indices is different from that in_addFounders
. As a result, the reserved token indices for old founders may not be completely removed, and old founders may still get new vesting tokens.Vulnerability Detail
The computation of owner's reserved token indices different between
_addFounders
andupdateFounders
. In_addFounders
, it starts withreservedUntilTokenId
(L161), while inupdateFounders
, it starts with0
(L412).https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/src/token/Token.sol#L160-L175
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/src/token/Token.sol#L411-L427
We can check the difference from the event log of
MintScheduled
in_addFounders
(L171), andMintUnscheduled
inupdateFounders
(L423).Let's see it with the existing test case
Token.t.sol#test_UpdateFoundersZeroOwnership
. We first setreservedUntilTokenId
to 17, and then run the test case withforge test -vvvvv --match-test test_UpdateFoundersZeroOwnership
.https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/test/utils/NounsBuilderTest.sol#L123-L134
The output is as follows. It is clear that
baseTokenId
inMintScheduled
is different from that inMintUnscheduled
.Impact
In
updateFounders
, the computation of owner's reserved token indices is different from that in_addFounders
. As a result, the reserved token indices for old founders may not be completely removed, and old founders may still get new vesting tokens.Code Snippet
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/src/token/Token.sol#L160-L175
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/src/token/Token.sol#L411-L427
Tool used
Manual Review
Recommendation
In
updateFounders
function, set the initial value ofbaseTokenId
toreservedUntilTokenId
.Duplicate of #42
The text was updated successfully, but these errors were encountered: