Platform: Code4rena
Start Date: 03/11/2022
Pot Size: $115,500 USDC
Total HM: 17
Participants: 120
Period: 7 days
Judge: LSDan
Total Solo HM: 1
Id: 174
League: ETH
Rank: 91/120
Findings: 1
Award: $61.35
š Selected for report: 0
š Solo Findings: 0
š Selected for report: IllIllI
Also found by: 0x1f8b, 0xNazgul, 0xRoxas, 0xSmartContract, Awesome, Aymen0909, B2, BClabs, Bnke0x0, Deekshith99, Deivitto, Diana, Dinesh11G, Funen, HE1M, HardlyCodeMan, Josiah, Nyx, Rahoz, RaymondFam, RedOneN, ReyAdmirado, Rolezn, Saintcode_, TomJ, Trust, __141345__, a12jmx, adriro, ajtra, aphak5010, apostle0x01, brgltd, btk, bulej93, c3phas, carlitox477, catwhiskeys, ch0bu, chaduke, chrisdior4, cryptonue, cryptostellar5, csanuragjain, ctf_sec, delfin454000, djxploit, durianSausage, erictee, fatherOfBlocks, gogo, i_got_hacked, immeas, joestakey, jumpdest7d, lukris02, martin, mcwildy, merlin, minhquanym, oyc_109, pashov, peanuts, pedr02b2, rbserver, rotcivegaf, rvierdiiev, sakman, saneryee, seyni, shark, slowmoses, tnevler, trustindistrust, w0Lfrum, yurahod, zaskoh
61.3462 USDC - $61.35
Issue Information: ERC20 operations can be unsafe due to different implementations and vulnerabilities in the standard.
It is therefore recommended to always either use OpenZeppelin's SafeERC20 library or at least to wrap each operation in a require statement.
To circumvent ERC20's approve functions race-condition vulnerability use OpenZeppelin's SafeERC20 library's safe{Increase|Decrease}Allowance functions.
In case the vulnerability is of no danger for your implementation, provide enough documentation explaining the reasonings.
Example 𤦠Bad:
IERC20(token).transferFrom(msg.sender, address(this), amount); š Good (using OpenZeppelin's SafeERC20):
import {SafeERC20} from "openzeppelin/token/utils/SafeERC20.sol";
// ...
IERC20(token).safeTransferFrom(msg.sender, address(this), amount); š Good (using require):
bool success = IERC20(token).transferFrom(msg.sender, address(this), amount); require(success, "ERC20 transfer failed");
Line-of-Credit/contracts/mock/SimpleRevenueContract.sol::17 => require(revenueToken.transfer(owner, revenueToken.balanceOf(address(this))), "Revenue: bad transfer"); Line-of-Credit/contracts/mock/SimpleRevenueContract.sol::19 => payable(owner).transfer(address(this).balance); Line-of-Credit/contracts/mock/SimpleRevenueContract.sol::26 => require(revenueToken.transfer(owner, revenueToken.balanceOf(address(this))), "Revenue: bad transfer"); Line-of-Credit/contracts/mock/SimpleRevenueContract.sol::28 => payable(owner).transfer(address(this).balance); Line-of-Credit/contracts/utils/LineLib.sol::48 => payable(receiver).transfer(amount); Line-of-Credit/contracts/utils/SpigotedLineLib.sol::134 => IERC20(sellToken).approve(swapTarget, amount);
Manual
Issue Information: Avoid floating pragmas for non-library contracts.
While floating pragmas make sense for libraries to allow them to be included with multiple different versions of applications, it may be a security risk for application implementations.
A known vulnerable compiler version may accidentally be selected or security tools might fall-back to an older compiler version ending up checking a different EVM compilation that is ultimately deployed on the blockchain.
It is recommended to pin to a concrete compiler version.
Example 𤦠Bad:
pragma solidity ^0.8.0; š Good:
pragma solidity 0.8.4;
Line-of-Credit/contracts/interfaces/IInterestRateCredit.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/interfaces/ISpigot.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/interfaces/ISpigotedLine.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/mock/ZeroEx.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/modules/credit/LineOfCredit.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/modules/credit/SecuredLine.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/modules/credit/SpigotedLine.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/modules/interest-rate/InterestRateCredit.sol::1 => pragma solidity ^0.8.9; Line-of-Credit/contracts/modules/oracle/Oracle.sol::2 => pragma solidity ^0.8.9; ::1 => pragma solidity ^0.8.9; ::1 => pragma solidity ^0.8.9; 2 => pragma solidity ^0.8.9; ::1 => pragma solidity ^0.8.9; 1 => pragma solidity ^0.8.9;
Manual
#0 - c4-judge
2022-12-06T14:59:53Z
dmvt marked the issue as grade-b