Platform: Code4rena
Start Date: 26/07/2022
Pot Size: $75,000 USDC
Total HM: 29
Participants: 179
Period: 6 days
Judge: LSDan
Total Solo HM: 6
Id: 148
League: ETH
Rank: 72/179
Findings: 5
Award: $143.85
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: cloudjunky
Also found by: 0x1f8b, 0x4non, 0x52, 0xDjango, 0xHarry, 0xNazgul, 0xNineDec, 0xf15ers, 0xsanson, 0xsolstars, 8olidity, Bnke0x0, CertoraInc, Chom, Deivitto, Dravee, GalloDaSballo, GimelSec, IllIllI, Jmaxmanblue, JohnSmith, Jujic, Kenshin, Krow10, Lambda, MEP, Noah3o6, RedOneN, Ruhum, StErMi, StyxRave, TomJ, Treasure-Seeker, TrungOre, _Adam, __141345__, arcoun, asutorufos, bardamu, bearonbike, bin2chen, brgltd, bulej93, c3phas, cRat1st0s, carlitox477, cccz, codexploder, cryptonue, cryptphi, cthulhu_cult, dharma09, dipp, djxploit, durianSausage, ellahi, giovannidisiena, hansfriese, horsefacts, hyh, immeas, indijanc, jayjonah8, jayphbee, joestakey, kenzo, kyteg, ladboy233, minhquanym, navinavu, obront, oyc_109, peritoflores, rbserver, reassor, rokinot, rotcivegaf, saian, scaraven, shenwilly, simon135, sseefried, teddav, zzzitron
0.0037 USDC - $0.00
This is a classic Code4rena issue:
The use of the deprecated transfer()
function for an address will inevitably make the transaction fail when:
Additionally, using higher than 2300 gas might be mandatory for some multisig wallets.
VS Code
It is recommended to use call
instead of transfer
. As a code reference, you may refer to the Openzeppelin Address.sendValue
implementation.
#0 - KenzoAgada
2022-08-04T06:29:19Z
Duplicate of #343
🌟 Selected for report: TomJ
Also found by: 0x4non, 0x52, 0xDjango, 0xNazgul, 0xf15ers, 0xsanson, 8olidity, Bnke0x0, CertoraInc, Ch_301, Chom, Dravee, GalloDaSballo, GimelSec, JC, Jujic, Kenshin, Kumpa, Lambda, M0ndoHEHE, PaludoX0, RedOneN, Ruhum, Sm4rty, Treasure-Seeker, TrungOre, Twpony, Waze, _Adam, __141345__, apostle0x01, arcoun, benbaessler, bin2chen, brgltd, cccz, cloudjunky, cryptonue, djxploit, ellahi, erictee, hansfriese, i0001, minhquanym, oyc_109, peritoflores, rbserver, reassor, rokinot, rotcivegaf, saian, shenwilly, sseefried
0.1513 USDC - $0.15
https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L234-L239 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L298-L305 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L358-L365
ERC 721 and ERC 1155 transfers do not check for contract existence.
As per the solidity docs:
The low-level functions
call
,delegatecall
andstaticcall
return true as their first return value if the account called is non-existent, as part of the design of the EVM. Account existence must be checked prior to calling if needed.
This means that if any NFT contract (or its logic contract if upgradeable) is self destructed, Golom will not revert any operations and assume any transfers of those contracts are successful (even if the attacker does not own those NFTs).
A new NFT project is launched called Goblins and becomes very popular. However, their contract is self destructed because of a vulnerability.
There are 50 offers on Goblin NFTs on the Golom marketplace. An attacker accepts all those offers and makes 100 ETH (effectively stealing from the offerers since he/she does not own any Goblin NFTs). Because neither of the transfers check for contract existence, the transactions do not fail even though the attacker does not own any Goblin NFTs.
VS Code
Marketplace contracts such as Opensea Seaport have a contract code existence check during transfers of ERC 721s and ERC 1155s.
It is advisable to add the same checks while transferring ERC 721s or ERC 1155s to be safe from such exploits.
#0 - 0xsaruman
2022-09-06T14:03:28Z
couldnt replicate, get error Error: Transaction reverted: function call to a non-contract account
there is no call, delegatecall and staticcall being made to nft contract
#1 - dmvt
2022-10-12T14:24:50Z
@0xsaruman There appears to be a proof of concept in #411. Is that what you used when attempting to replicate?
#2 - dmvt
2022-10-21T12:53:36Z
Duplicate of #342
🌟 Selected for report: codexploder
Also found by: 0x1f8b, 0xNineDec, 0xsanson, RustyRabbit, Treasure-Seeker, berndartmueller, chatch, teddav
At construction, the GolomTrader contract computes the domain separator using the network’s chainID, which is fixed at the time of deployment. In the event of a post-deployment chain fork, the chainID cannot be updated, and the signatures may be replayed across both versions of the chain.
Bob signs an order on the Ethereum mainnet. He signs the domain separator with a signature to sell an NFT. Later, Ethereum is hard-forked and as a result, there are two parallel chains with the same chain ID, and Eve can use Bob’s signature to match orders on the forked chain.
This exact vulnerability was also reported on LooksRare by Trail of Bits as a High Severity bug. Here's the report for your reference.
VS Code
To mitigate this risk, if a change in the chainID is detected, the domain separator can be cached and regenerated. Alternatively, instead of regenerating the entire domain separator, the chainID can be included in the schema of the signature passed to the order hash.
#0 - 0xsaruman
2022-08-20T17:46:23Z
🌟 Selected for report: AuditsAreUS
Also found by: 0xSky, CertoraInc, GimelSec, GiveMeTestEther, Green, Lambda, Ruhum, RustyRabbit, Treasure-Seeker, Twpony, arcoun, bin2chen, cccz, codexploder, cryptonue, dipp, horsefacts, jayphbee, joestakey, minhquanym, obront, peritoflores, rbserver, reassor, rotcivegaf, scaraven, ych18
4.5163 USDC - $4.52
When a listed NFT is bought using ETH (order type = 0), the msg.value check is a loose one (>=) but the excess msg.value is not refunded
This line of code ensures a min msg.value but the excess msg.value is not refunded anywhere in the fillAsk
function.
This will cause a permanent loss of funds for the buyer.
VS Code
Either refund the excess msg.value amount or change the check to a strict one (== rather than >=).
#0 - KenzoAgada
2022-08-04T02:52:17Z
Duplicate of #75
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x4non, 0x52, 0xA5DF, 0xDjango, 0xLovesleep, 0xNazgul, 0xNineDec, 0xSmartContract, 0xackermann, 0xc0ffEE, 0xf15ers, 0xmatt, 0xsanson, 0xsolstars, 8olidity, AuditsAreUS, Bahurum, Bnke0x0, CRYP70, CertoraInc, Ch_301, Chom, CryptoMartian, Deivitto, DevABDee, Dravee, ElKu, Franfran, Funen, GalloDaSballo, GimelSec, GiveMeTestEther, Green, JC, Jmaxmanblue, JohnSmith, Jujic, Junnon, Kenshin, Krow10, Kumpa, Lambda, MEP, Maxime, MiloTruck, Mohandes, NoamYakov, Picodes, RedOneN, Rohan16, Rolezn, Ruhum, RustyRabbit, Sm4rty, Soosh, StErMi, StyxRave, Tadashi, TomJ, Treasure-Seeker, TrungOre, Waze, _Adam, __141345__, ajtra, ak1, apostle0x01, arcoun, asutorufos, async, benbaessler, berndartmueller, bin2chen, brgltd, c3phas, cRat1st0s, carlitox477, chatch, codetilda, codexploder, cryptonue, cryptphi, csanuragjain, cthulhu_cult, delfin454000, dipp, dirk_y, djxploit, ellahi, exd0tpy, fatherOfBlocks, giovannidisiena, hansfriese, horsefacts, hyh, idkwhatimdoing, indijanc, jayfromthe13th, jayphbee, joestakey, kenzo, kyteg, lucacez, luckypanda, mics, minhquanym, obront, oyc_109, pedr02b2, rajatbeladiya, rbserver, reassor, robee, rokinot, rotcivegaf, sach1r0, saian, saneryee, sashik_eth, scaraven, shenwilly, simon135, sseefried, supernova, teddav, ych18, zuhaibmohd, zzzitron
35.1687 USDC - $35.17
https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/core/GolomTrader.sol#L459-L461 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/rewards/RewardDistributor.sol#L313-L315 https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/governance/Timlock.sol#L152-L154
Multiple contracts (GolomTrader, RewardDistributor and Timlock) have empty fallback and receive function implementations. This can cause a loss of funds as people may by mistake send the contract some eth, and will never be able to recover this ETH.
Since there is no purpose served by the fallback/receive functions, it is advisable to remove these functions.
Easy way to check is try sending any of these contracts some eth. It can now never be recovered.
VS Code
Delete the fallback and receive functions
#0 - 0xsaruman
2022-08-20T11:45:25Z
#1 - dmvt
2022-10-14T15:28:08Z
Lack of a recovery function is low risk. Downgrading to QA.