You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.
sherlock-admin opened this issue
Dec 1, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
The founder allocation logic will be broken after updating founders when reservedUntilTokenId > 0.
Summary
While updating the founders with positive reservedUntilTokenId, it doesn't remove the previous recipicent mapping properly and it might have more founder ownership than expected.
Vulnerability Detail
updateFounders() is used to update founders by an owner.
File: nouns-protocol\src\token\Token.sol
412: uint256 baseTokenId; //@audit starts from 0413:
414: for (uint256 j; j < cachedFounder.ownershipPct; ++j) {
415: // Get the next index that hasn't already been cleared416: while (clearedTokenIds[baseTokenId] !=false) {
417: baseTokenId = (++baseTokenId) %100;
418: }
419:
420: delete tokenRecipient[baseTokenId];
421: clearedTokenIds[baseTokenId] =true;
422:
423: emitMintUnscheduled(baseTokenId, i, cachedFounder);
424:
425: // Update the base token id426: baseTokenId = (baseTokenId + schedule) %100;
427: }
While removing the previous founders, it uses the same mechanism as _addFounders() but baseTokenId starts from 0, not reservedUntilTokenId.
As a result, it will remove wrong token IDs and some recipients wouldn't be cleared at all if reservedUntilTokenId > 0.
Here is a coded POC which can be added to Token.t.sol.
After updating founders, it has 60% ownership instead of 50%.
Impact
The founder allocation logic will be broken after updating founders if reservedUntilTokenId > 0.
Although the owner knows about that, he can't mitigate with the current implementation of updateFounders().
sherlock-admin2
changed the title
Plain Caramel Porcupine - The founder allocation logic will be broken after updating founders when reservedUntilTokenId > 0.
KupiaSec - The founder allocation logic will be broken after updating founders when reservedUntilTokenId > 0.
Dec 13, 2023
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
KupiaSec
high
The founder allocation logic will be broken after updating founders when
reservedUntilTokenId > 0
.Summary
While updating the founders with positive
reservedUntilTokenId
, it doesn't remove the previous recipicent mapping properly and it might have more founder ownership than expected.Vulnerability Detail
updateFounders()
is used to update founders by an owner.While removing the previous founders, it uses the same mechanism as _addFounders() but
baseTokenId
starts from 0, notreservedUntilTokenId
.As a result, it will remove wrong token IDs and some recipients wouldn't be cleared at all if
reservedUntilTokenId > 0
.Here is a coded POC which can be added to
Token.t.sol
.After updating founders, it has 60% ownership instead of 50%.
Impact
The founder allocation logic will be broken after updating founders if
reservedUntilTokenId > 0
.Although the owner knows about that, he can't mitigate with the current implementation of
updateFounders()
.Code Snippet
https://github.com/sherlock-audit/2023-09-nounsbuilder/tree/main/nouns-protocol/src/token/Token.sol#L412
Tool used
Manual Review
Recommendation
The purpose of this logic is to remove previous ownership settings.
So we can just delete
tokenRecipient
mapping from 0 to 99.Duplicate of #42
The text was updated successfully, but these errors were encountered: