Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mintLegendaryGobbler() can burn unreveal Gobbler, lead to loss emissionMultiple #159

Closed
code423n4 opened this issue Sep 26, 2022 · 5 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-09-artgobblers/blob/d2087c5a8a6a4f1b9784520e7fe75afa3a9cbdbe/src/ArtGobblers.sol#L435

Vulnerability details

Impact

when Gobbler unreveal , Gobbler.emissionMultiple==0,mintLegendaryGobbler() does not prevent burn unrevealed Gobbler, which will result in the loss emissionMultiple

Proof of Concept

    function mintLegendaryGobbler(uint256[] calldata gobblerIds) external returns (uint256 gobblerId) {
    ..

           
            for (uint256 i = 0; i < cost; ++i) {
                id = gobblerIds[i];

                if (id >= FIRST_LEGENDARY_GOBBLER_ID) revert CannotBurnLegendary(id);

                require(getGobblerData[id].owner == msg.sender, "WRONG_FROM");

                burnedMultipleTotal += getGobblerData[id].emissionMultiple;
                 //******** No check id is not revealed,  getGobblerData[id].emissionMultiple == 0 ********//

                emit Transfer(msg.sender, getGobblerData[id].owner = address(0), id);
            }

    ..                

Tools Used

Recommended Mitigation Steps

    function mintLegendaryGobbler(uint256[] calldata gobblerIds) external returns (uint256 gobblerId) {
    ..

            for (uint256 i = 0; i < cost; ++i) {
                id = gobblerIds[i];

                if (id >= FIRST_LEGENDARY_GOBBLER_ID) revert CannotBurnLegendary(id);
+++             if (id > gobblerRevealsData.lastRevealedId) revert CannotBurnUnreveal(id);

                require(getGobblerData[id].owner == msg.sender, "WRONG_FROM");

                burnedMultipleTotal += getGobblerData[id].emissionMultiple;

                emit Transfer(msg.sender, getGobblerData[id].owner = address(0), id);
            }

    ..                
@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Sep 26, 2022
code423n4 added a commit that referenced this issue Sep 26, 2022
@zobront
Copy link

zobront commented Sep 27, 2022

This is accurate, but is only a way for users to harm themselves. I'd call it QA, or Medium severity at best.

@Shungy
Copy link
Member

Shungy commented Sep 28, 2022

Duplicate: #363

@Shungy
Copy link
Member

Shungy commented Sep 29, 2022

This is accurate, but is only a way for users to harm themselves. I'd call it QA, or Medium severity at best.

I sort of agree. Because people might still want to use unrevealed ones if they are on a pinch to get legendary. As a reveal might need to wait up to a day. All the recommendations just say "do not allow minting with unrevealed", and some incorrectly say "just reveal during the legendary mint" (this would revert most of the time). My recommendation would be to have an extra bool argument in mint legendary function as a flag for allowing or disallowing using unrevealed ones. This could allow people to use unrevealed ones if they go through an "advanced settings" modal in the UI and enable it that way if they accept the consequences.

@GalloDaSballo GalloDaSballo added the duplicate This issue or pull request already exists label Sep 29, 2022
@GalloDaSballo
Copy link
Collaborator

#254

@GalloDaSballo GalloDaSballo added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Oct 11, 2022
@GalloDaSballo
Copy link
Collaborator

L

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

4 participants