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` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Malicious pausing of Auction Contract via Gas Exception on Internal Mint
Summary
The settleCurrentAndCreateNewAuction() function can be used by any user to pause the Auction contract. This occurs by causing the internal _createAuction() call to fail via a child call gas limit exception during the token.mint() execution.
Vulnerability Details
The settleCurrentAndCreateNewAuction() function makes an internal call to _createAuction().
function settleCurrentAndCreateNewAuction() external nonReentrant whenNotPaused {
_settleAuction();
_createAuction();
}
Inside _createAuction(), an NFT minting occurs through token.mint()
try token.mint() returns (uint256tokenId) {
According to the EIP-150call opcode can consume as most 63/64 of parrent calls' gas. That means token.mint() can fail since there will be no gas.
All in all, if token.mint() fail on gas and the rest gas is enough for pausing the contract by calling _pause in catch statement the contract will be paused.
Please note, that a bug can be exploitable if the token.mint() consume more than 1.500.000 of gas, because 1.500.000 / 64 > 20.000 that need to pause the contract. Also, the logic of token.mint() includes traversing the array up to 100 times, that's heavy enough to reach 1.500.000 gas limit.
Impact
Contract can be paused by any user by passing special amount of gas for the call of settleCurrentAndCreateNewAuction (which consists of two internal calls of _settleAuction and _createAuction functions).
sherlock-admin
changed the title
Lively Carob Monkey - Malicious pausing of Auction Contract via Gas Exception on Internal Mint
popeye - Malicious pausing of Auction Contract via Gas Exception on Internal Mint
Dec 13, 2023
sherlock-admin
added
Reward
A payout will be made for this issue
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
and removed
Non-Reward
This issue will not receive a payout
labels
Dec 21, 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` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
popeye
medium
Malicious pausing of Auction Contract via Gas Exception on Internal Mint
Summary
The
settleCurrentAndCreateNewAuction()
function can be used by any user to pause the Auction contract. This occurs by causing the internal_createAuction()
call to fail via a child call gas limit exception during thetoken.mint()
execution.Vulnerability Details
The
settleCurrentAndCreateNewAuction()
function makes an internal call to_createAuction()
.Inside
_createAuction()
, an NFT minting occurs throughtoken.mint()
According to the EIP-150
call
opcode can consume as most 63/64 of parrent calls' gas. That meanstoken.mint()
can fail since there will be no gas.All in all, if
token.mint()
fail on gas and the rest gas is enough for pausing the contract by calling_pause
in catch statement the contract will be paused.Please note, that a bug can be exploitable if the
token.mint()
consume more than 1.500.000 of gas, because 1.500.000 / 64 > 20.000 that need to pause the contract. Also, the logic oftoken.mint()
includes traversing the array up to 100 times, that's heavy enough to reach 1.500.000 gas limit.Impact
Contract can be paused by any user by passing special amount of gas for the call of
settleCurrentAndCreateNewAuction
(which consists of two internal calls of_settleAuction
and_createAuction
functions).Code Snippet
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/src/auction/Auction.sol#L238-L241
https://github.com/sherlock-audit/2023-09-nounsbuilder/blob/main/nouns-protocol/src/auction/Auction.sol#L292-L329
Tool used
Manual Review
Recommendation
To address this, the minting logic should be separated into its own private function with a passed-in gas stipend sufficient to prevent exceptions:
Duplicate of #243
The text was updated successfully, but these errors were encountered: