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.
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
BaseTokenID is wrongfully set to reservedUntilTokenId
Summary
In Token.sol function _addFounders contains line of code uint256 baseTokenId = reservedUntilTokenId; , however if we delve deeper into what this line of code does we will see problems arise.
Vulnerability Detail
We know that baseTokenId should be a number between 0 and 100 & the tokens for the founders should be applied after the reserve. However if we have reservedUntilTokenId is greater than 100 which is not rare (in a case where there are more than 100 reserved tokens for minters). This is where the problem starts.
Impact
for (uint256 j; j < founderPct; ++j) {
// Get the available token id
baseTokenId =_getNextTokenId(baseTokenId);
// Store the founder as the recipient
tokenRecipient[baseTokenId] = newFounder;
emitMintScheduled(baseTokenId, founderId, newFounder);
the code will wrongfully start at the wrong baseTokenId and will start counting from there (instead of storing baseTokenId starting from 0) also it will emit MintScheduled which will take the wrong parameters considering it takes baseTokenId and Newfounder which has the incorrect baseTokenId stored.
This will cause the MintScheduled to have a different BaseTokenIdthan the MintUnscheduled, obviously we want MintScheduled to be the same as MintUnscheduled (also confirmed this on discord with the devs).
We also do not want the BaseTokenIdto ever exceed 100, but since the first BaseTokenId goes into the loop and gets stored in MintScheduled before going through the % 100 this means it will take the same number as reservedUntilTokenId
sherlock-admin
changed the title
Jumpy Pewter Goat - BaseTokenID is wrongfully set to reservedUntilTokenId
whoismxuse - BaseTokenID is wrongfully set to reservedUntilTokenId
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
whoismxuse
medium
BaseTokenID is wrongfully set to reservedUntilTokenId
Summary
In
Token.sol
function_addFounders
contains line of codeuint256 baseTokenId = reservedUntilTokenId;
, however if we delve deeper into what this line of code does we will see problems arise.Vulnerability Detail
We know that
baseTokenId
should be a number between 0 and 100 & the tokens for the founders should be applied after the reserve. However if we havereservedUntilTokenId
is greater than 100 which is not rare (in a case where there are more than 100 reserved tokens for minters). This is where the problem starts.Impact
the code will wrongfully start at the wrong
baseTokenId
and will start counting from there (instead of storingbaseTokenId
starting from 0) also it will emitMintScheduled
which will take the wrong parameters considering it takesbaseTokenId
andNewfounder
which has the incorrectbaseTokenId
stored.This will cause the
MintScheduled
to have a differentBaseTokenId
than theMintUnscheduled
, obviously we wantMintScheduled
to be the same asMintUnscheduled
(also confirmed this on discord with the devs).We also do not want the
BaseTokenId
to ever exceed 100, but since the firstBaseTokenId
goes into the loop and gets stored inMintScheduled
before going through the % 100 this means it will take the same number asreservedUntilTokenId
Code Snippet
https://github.com/ourzora/nouns-protocol/blob/e81cfce40e09b8abd9222443373ac747598bac4b/src/token/Token.sol#L161C9
Tool used
Manual Review
Recommendation
Duplicate of #42
The text was updated successfully, but these errors were encountered: