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: 178/179
Findings: 1
Award: $0.00
🌟 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
Using address.transfer()
make the assumption that opcode gas costs are not subject to change, but EIP 1884 increased the SLOAD opcode gas cost and other gas cost raises might happen in the future.
It makes this contract dependent on opcode gas cost updates as it would only forward a fixed amount of 2300 gas units to the payAddress
, which might require more to internally process the transfer (ex: reading/writing from/to the storage on receive).
It may result to the failure of the ether transfers of all the functions using payEther()
and may affect the royalties distribution.
address.transfer()
and address.send()
have a limited forwarded gas amount to prevent reentrancy attacks.
Most of the functions using 'payEther()' are already implementing a nonReentrant
lock. Using this lock should be enough to prevent a reentrancy if paired with an enforced checks-effects-interactions pattern.
Then, address.transfer()
could be replaced with a low level address.call.value()
which will forward the remaining gas with the call:
(bool success, ) = address.call.value(amount)(""); require(success, "Transfer failed.");
#0 - KenzoAgada
2022-08-03T14:09:26Z
Duplicate of #343