Platform: Code4rena
Start Date: 12/07/2022
Pot Size: $35,000 USDC
Total HM: 13
Participants: 78
Period: 3 days
Judge: 0xean
Total Solo HM: 6
Id: 135
League: ETH
Rank: 11/78
Findings: 3
Award: $1,098.49
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: hansfriese
Also found by: jonatascm
feenominators
supposed to be updated using the array of indexes i
not the current position of array length d
The function updates the fenominators[x]
instead of feenominators[i[x]]
for (uint256 x; x < len;) { if (d[x] < MIN_FEENOMINATOR) { revert Exception(18, uint256(d[x]), 0, address(0), address(0)); } //Not updating the position i[x] of feenominators variable feenominators[x] = d[x]; emit SetFee(i[x], d[x]); unchecked { x++; } }
To fix this issue following this code:
for (uint256 x; x < len;) { if (d[x] < MIN_FEENOMINATOR) { revert Exception(18, uint256(d[x]), 0, address(0), address(0)); } - feenominators[x] = d[x]; + feenominators[i[x]] = d[x]; emit SetFee(i[x], d[x]); unchecked { x++; } }
#0 - JTraversa
2022-07-15T22:58:14Z
Duplicate of #117
#1 - bghughes
2022-08-03T14:43:04Z
Duplicate of #117
🌟 Selected for report: 0xDjango
Also found by: 0x1f8b, 8olidity, Bahurum, Lambda, arcoun, caventa, csanuragjain, hansfriese, joestakey, jonatascm, oyc_109, ronnyx2017
48.5491 USDC - $48.55
https://github.com/code-423n4/2022-07-swivel/blob/fd36ce96b46943026cb2dfcb76dfa3f884f51c18/Tokens/ZcToken.sol#L131-L136 https://github.com/code-423n4/2022-07-swivel/blob/fd36ce96b46943026cb2dfcb76dfa3f884f51c18/Tokens/ZcToken.sol#L110-L118
If any holder wants to withdraw ZcToken
in behalf of any user, it can't be done because of the verification in withdraw
function.
Following the logic in the code:
+ //Skip this logic because it is someone else executing if (holder == msg.sender) {...} else { uint256 allowed = allowance[holder][msg.sender]; + //If the holders allowed more then previewAmount reverts if (allowed >= previewAmount) { revert Approvals(allowed, previewAmount); } +. //Here: allowance[holder][msg.sender] < previewAmount + //But if the allowed is less than previewAmount it will breaks here allowance[holder][msg.sender] -= previewAmount; redeemer.authRedeem(protocol, underlying, maturity, holder, receiver, previewAmount); return previewAmount; }
To fix this issue following this code:
- if (allowed >= previewAmount) { + if (allowed < previewAmount) { revert Approvals(allowed, previewAmount); } ... - if (allowed >= principalAmount) { + if (allowed < principalAmount) { revert Approvals(allowed, principalAmount); }
#0 - JTraversa
2022-07-20T07:25:02Z
Duplicate of #129
#1 - robrobbins
2022-08-04T20:27:55Z
see #180
#2 - bghughes
2022-08-04T23:32:42Z
Duplicate of #129
🌟 Selected for report: joestakey
Also found by: 0x1f8b, 0x52, 0xDjango, 0xNazgul, 0xNineDec, 8olidity, Avci, Bahurum, Bnke0x0, Chom, ElKu, Funen, GimelSec, JC, Junnon, Kaiziron, Meera, PaludoX0, Picodes, ReyAdmirado, Sm4rty, Soosh, Waze, _Adam, __141345__, ak1, aysha, benbaessler, bin2chen, c3phas, cccz, cryptphi, csanuragjain, defsec, exd0tpy, fatherOfBlocks, gogo, hake, hansfriese, itsmeSTYJ, jonatascm, kyteg, mektigboy, oyc_109, pashov, rbserver, rishabh, robee, rokinot, sach1r0, sashik_eth, scaraven, simon135, slywaters
44.3417 USDC - $44.34
create
can be executed before setMarketPlace
by mistake, creating a ZcToken
with wrong marketPlace
Before deploy the Creator
contract the owner
can call the create
function before setMarketPlace
that don't check the marketPlace
and by mistake can create a invalid ZcToken
Proof of ConceptThe function updates the fenominators[x]
instead of feenominators[i[x]]
Should remove the function setMarketPlace
and add marketPlace
to constructor.
- address public marketPlace; + address public immutable marketPlace; constructor(address m) { admin = msg.sender; + marketPlace = m; } - function setMarketPlace(address m) external authorized(admin) returns (bool) { - if (marketPlace != address(0)) { - revert Exception(33, 0, 0, marketPlace, address(0)); - } - marketPlace = m; - return true; - }
Natspec
issueNatspec
is incorrect or missing
Should fix the following natspec:
In Swivel.sol: - /// @notice p Protocol Enum value associated with this market pair + /// @param p Protocol Enum value associated with this market pair In VaultTracker + /// @param p Protocol Enum value associated with this market pair /// @param m Maturity timestamp associated with this vault /// @param c Compounding Token address associated with this vault /// @param s Address of the deployed swivel contract constructor(uint8 p, uint256 m, address c, address s) {
#0 - robrobbins
2022-08-31T00:20:23Z
creator has to go out first, as marketplace expects it's address at construction, it is thus the responsibily of the deploying admin to assure that address is set.