Submitted by Lambda
https://github.com/code-423n4/2022-08-frax/blob/b58c9b72f5fe8fab81f7436504e7daf60fd124e3/src/contracts/FraxlendPairCore.sol#L989
https://github.com/code-423n4/2022-08-frax/blob/b58c9b72f5fe8fab81f7436504e7daf60fd124e3/src/contracts/FraxlendPairCore.sol#L1002
When a position only has a bit of collateral left (e.g., because a previous liquidateClean call provided just too little shares or the exchange rate just changed), there is no incentive anymore to call liquidateClean again. The maximum amount that a user will get is the remaining collateral balance, which does not cover the gas fees in such cases.
Therefore, the bad debt is never written off, meaning that the mechanism does not work in such cases and these pairs become toxic (as the last user will have to pay for the leftover borrow shares).
To avoid such scenarios, it should not be possible to remove almost all of the collateral. Consider introducing an upper limit, e.g. 95%. Above this limit, no dirty liquidations would be allowed.
DrakeEvans (Frax) acknowledged, but disagreed with severity and commented:
gititGoro (judge) commented:
For this contest, 85 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by 0x1f8b received the top score from the judge.
The following wardens also submitted reports: pfapostol, Rolezn, yac, brgltd, Deivitto, 0xNazgul, IllIllI, mics, oyc_109, Bnke0x0, reassor, 0xDjango, MiloTruck, bin2chen, robee, c3phas, rbserver, Junnon, gogo, RoiEvenHaim, ReyAdmirado, Waze, tabish, Aymen0909, CodingNameKiki, auditor0517, ElKu, beelzebufo, kyteg, fatherOfBlocks, Lambda, ballx, LeoS, berndartmueller, erictee, ret2basic, TomJ, 0x52, ayeslick, cccz, yash90, Funen, 0xA5DF, JC, Dravee, medikko, cryptonue, cryptphi, delfin454000, sach1r0, simon135, Sm4rty, sryysryy, durianSausage, dy, minhquanym, Rohan16, zzzitron, a12jmx, hyh, ak1, asutorufos, CertoraInc, Chom, 0xsolstars, __141345__, 0xSmartContract, djxploit, SooYa, _Adam, 0xmatt, cRat1st0s, The_GUILD, Yiko, EthLedger, gzeon, ignacio, Noah3o6, 0xNineDec, d3e4, dipp, ladboy233, PaludoX0, and SaharAP.
