Platform: Code4rena
Start Date: 13/12/2023
Pot Size: $36,500 USDC
Total HM: 18
Participants: 110
Period: 8 days
Judge: 0xTheC0der
Id: 311
League: ETH
Rank: 42/110
Findings: 1
Award: $148.46
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: bart1e
Also found by: 00xSEV, 0xDING99YA, Ryonen, Tricko, hals, wintermute
148.462 USDC - $148.46
https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/AuctionHouse.sol#L313 https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/AuctionHouse.sol#L328 https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/AuctionHouse.sol#L311
Under certain circumstances (either because the NFT to be minted has enough creators or because the NFT has content related to elevated metadata), there is a possibility for any malicious user to execute the AuctionHouse::settleCurrentAndCreateNewAuction
function with sufficient gas for it to fail within try verbs.mint()
due to gas insufficiency and continue with the remaining gas in catch {_pause();}
.
This would be possible since, to complete the execution of the function AuctionHouse::_createAuction
with a pause, the transaction should have approximately 23k
gas to complete it. This would imply that 63/64
must be spent within try verbs.mint()
, i.e., 1_500_000
gas at the moment of entering try verbs.mint()
. This would be possible the more data-loaded the NFT is or also the more creators it has.
Foundry
Perhaps a script to unpause the contract offchain could be useful, even if it's a dirty solution
DoS
#0 - c4-pre-sort
2023-12-22T16:03:06Z
raymondfam marked the issue as sufficient quality report
#1 - c4-pre-sort
2023-12-22T16:03:43Z
raymondfam marked the issue as duplicate of #93
#2 - c4-pre-sort
2023-12-24T14:35:57Z
raymondfam marked the issue as duplicate of #195
#3 - c4-judge
2024-01-06T13:22:14Z
MarioPoneder marked the issue as satisfactory
🌟 Selected for report: bart1e
Also found by: 00xSEV, 0xDING99YA, Ryonen, Tricko, hals, wintermute
148.462 USDC - $148.46
https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/AuctionHouse.sol#L309 https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/AuctionHouse.sol#L328 https://github.com/code-423n4/2023-12-revolutionprotocol/blob/main/packages/revolution/src/AuctionHouse.sol#L265-L271
Whether with malicious intent or not, a user can create an NFT design good enough to win in voting but heavy enough in data for settleCurrentAndCreateNewAuction
to use more than 30M
gas to complete. This can also take advantage of the fact that _settleAuction
is heavy in terms of gas consumed, even in cases where the contract is paused and unpause is used since _createAuction
is called immediately. Due to consuming more than 30M gas, the contract would either revert or re-pause
.
ICultureIndex.ArtPieceMetadata memory metadata = ICultureIndex.ArtPieceMetadata("VERY HEAVY NFT") ICultureIndex.CreatorBps[] memory creators = new ICultureIndex.CreatorBps[](100); for(uint160 i = 1; i <= creators.length; i++){ creators[i-1] = ICultureIndex.CreatorBps({ creator: address(i), bps: 100 }); } uint256 pregasCreatePiece = gasleft(); uint256 pieceId = cultureIndex.createPiece(metadata, creators); console.log(pregasCreatePiece - gasleft()); console.log("Gas consumed create piece"); vm.startPrank(address(erc20TokenEmitter)); erc20Token.mint(address(this), 10); vm.roll(block.number + 1); vm.startPrank(address(this)); cultureIndex.vote(pieceId); vm.startPrank(address(auction)); uint256 preGas = gasleft(); uint256 tokenId = erc721Token.mint(); uint256 postGas = gasleft(); console.log(preGas - postGas); console.log("Gas consumed: ");
Additionally, it should be demonstrated that mint
is heavier than createPiece
.
Gas consumed create piece: 29_087_428
Gas consumed mint: 30_154_233
Foundry
Implementing a gas limit in the createPiece
function would be advisable.
DoS
#0 - c4-pre-sort
2023-12-22T16:11:00Z
raymondfam marked the issue as sufficient quality report
#1 - c4-pre-sort
2023-12-22T16:11:14Z
raymondfam marked the issue as duplicate of #93
#2 - c4-pre-sort
2023-12-24T14:35:58Z
raymondfam marked the issue as duplicate of #195
#3 - c4-judge
2024-01-06T13:18:09Z
MarioPoneder changed the severity to 2 (Med Risk)
#4 - c4-judge
2024-01-06T13:22:45Z
MarioPoneder marked the issue as satisfactory
#5 - MarioPoneder
2024-01-06T13:23:36Z
See comment on primary issue: https://github.com/code-423n4/2023-12-revolutionprotocol-findings/issues/195#issuecomment-1879684718
#6 - c4-judge
2024-01-06T13:23:41Z
MarioPoneder marked the issue as partial-25
#7 - c4-judge
2024-01-11T18:25:57Z
MarioPoneder marked the issue as not a duplicate
#8 - c4-judge
2024-01-11T18:43:18Z
MarioPoneder marked the issue as duplicate of #195
#9 - c4-judge
2024-01-11T18:43:24Z
MarioPoneder marked the issue as partial-25