Platform: Code4rena
Start Date: 24/07/2023
Pot Size: $100,000 USDC
Total HM: 18
Participants: 73
Period: 7 days
Judge: alcueca
Total Solo HM: 8
Id: 267
League: ETH
Rank: 54/73
Findings: 1
Award: $44.88
π Selected for report: 0
π Solo Findings: 0
π Selected for report: immeas
Also found by: 0x70C9, 0xAnah, 0xArcturus, 0xComfyCat, 0xWaitress, 0xackermann, 0xkazim, 2997ms, 33audits, Arz, Aymen0909, ChrisTina, JP_Courses, John_Femi, Jorgect, Kaysoft, LosPollosHermanos, MohammedRizwan, Nyx, Rolezn, Sathish9098, Stormreckson, T1MOH, Tendency, Topmark, Udsen, Vagner, albertwh1te, ast3ros, banpaleo5, berlin-101, catellatech, cats, codetilda, cryptonue, eeshenggoh, fatherOfBlocks, hals, jamshed, jaraxxus, josephdara, kankodu, kodyvim, kutugu, lanrebayode77, mert_eren, nadin, naman1778, niki, petrichor, ravikiranweb3, said, solsaver, souilos, twcctop, wahedtalash77
44.8793 USDC - $44.88
The comptroller contract is missing importan validation when the admin set a new close factor
Lack on validation when setting new close factor can let the contract in a position where liquidator can liquidate more than he should.
The comptroller contract is declaring in the top of the code the next staments:
// closeFactorMantissa must be strictly greater than this value uint256 internal constant closeFactorMinMantissa = 0.05e18; // 0.05 // closeFactorMantissa must not exceed this value uint256 internal constant closeFactorMaxMantissa = 0.9e18; // 0.9
however when the admin set the close factor there is no validation of the new close factor:
file:src/core/Comptroller.sol function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); }
manual
check if the close factor is in the properly range:
function _setCloseFactor(uint newCloseFactorMantissa) external returns (uint) { // Check caller is admin require(msg.sender == admin, "only admin can set close factor"); require(newCloseFactorMantissa>=closeFactorMinMantissa); require(newCloseFactorMantissa<= closeFactorMaxMantissa); uint oldCloseFactorMantissa = closeFactorMantissa; closeFactorMantissa = newCloseFactorMantissa; emit NewCloseFactor(oldCloseFactorMantissa, closeFactorMantissa); return uint(Error.NO_ERROR); }
Other
#0 - c4-pre-sort
2023-08-03T13:52:37Z
0xSorryNotSorry marked the issue as primary issue
#1 - c4-sponsor
2023-08-03T22:06:53Z
ElliotFriedman marked the issue as disagree with severity
#2 - c4-sponsor
2023-08-03T22:06:56Z
ElliotFriedman marked the issue as sponsor confirmed
#3 - c4-judge
2023-08-12T20:54:50Z
alcueca changed the severity to QA (Quality Assurance)
#4 - c4-judge
2023-08-12T20:54:57Z
alcueca marked the issue as grade-a