Platform: Code4rena
Start Date: 07/09/2022
Pot Size: $20,000 CANTO
Total HM: 7
Participants: 65
Period: 1 day
Judge: 0xean
Total Solo HM: 3
Id: 159
League: ETH
Rank: 64/65
Findings: 1
Award: $39.22
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: lukris02
Also found by: 0x040, 0x1f8b, 0x52, 0xA5DF, 0xNazgul, 0xSky, Bnke0x0, Bronicle, CertoraInc, Chom, CodingNameKiki, Deivitto, Diraco, Dravee, EthLedger, IgnacioB, JC, JansenC, Jeiwan, R2, RaymondFam, ReyAdmirado, Rolezn, SinceJuly, TomJ, Tomo, Yiko, a12jmx, ajtra, ak1, codexploder, cryptphi, csanuragjain, erictee, fatherOfBlocks, gogo, hake, hansfriese, hickuphh3, ignacio, ontofractal, oyc_109, p_crypt0, pashov, peritoflores, rajatbeladiya, rbserver, rokinot, rvierdiiev, tnevler
242.8216 CANTO - $39.22
isStable
, in case it was set by mistakeBaseV1Router01.isStable[someTokenAddress]
can only be set to true, in case the wrong token was set - there's no way to reverse it.
Consider allowing to set it to false too by modifying the setStable()
function:
function setStable(address underlying, bool val) external returns (uint) { if (msg.sender != admin) { revert SenderNotAdmin(msg.sender, admin); } isStable[underlying] = val; }
Attacker can create a malicious token with the same symbol as the known tokens, therefore it'll be more secure to identify the known tokens (cCANTO, cNOTE, cUSDT, cUSDC) at getUnderlyingPrice()
by their address (storing them as immutable vars) rather than by their symbol.
Even though this is not going to affect legitimate lending markets, attacker can use this to try convince victims his token (or lending market created with this token) is real.
The internal function BaseV1Router01._returnStableBooleans
isn't used and can be removed
getPriceLP()
assumes all pairs are created with NOTE/CANTOFiling this is QA since it seems from the docs that CANTO indeed doesn't intend to create other kinds of pairs.
However, it is possible to create pairs with none of them. So it is worth verifying that assumption in order to not cause errors for other users who may be using this oracle, or in case a stable pair was mistakenly created with CANTO or vice versa.
Simply require that if token0
isn't note/canto then the token1
should be, and revert otherwise.