Platform: Code4rena
Start Date: 25/10/2022
Pot Size: $50,000 USDC
Total HM: 18
Participants: 127
Period: 5 days
Judge: 0xean
Total Solo HM: 9
Id: 175
League: ETH
Rank: 25/127
Findings: 3
Award: $376.98
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: jayphbee
Also found by: catchup, cccz, corerouter, trustindistrust
342.9734 USDC - $342.97
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L605-L610
When a user debt is liquidated, if the escrow balance is less than the liquidation fee, no fee is paid.
605: if(liquidationFeeBps > 0) { 606: uint liquidationFee = repaidDebt * 1 ether / price * liquidationFeeBps / 10000; 607: if(escrow.balance() >= liquidationFee) { 608: escrow.pay(gov, liquidationFee); 609: } 610: }
However, escrow balance can be deducted as liquidation fee in that case. Governance is missing out on the fees it can collect.
Manual review
Change the above code block as:
605: if(liquidationFeeBps > 0) { 606: uint liquidationFee = repaidDebt * 1 ether / price * liquidationFeeBps / 10000; 607: if(escrow.balance() >= liquidationFee) { 608: escrow.pay(gov, liquidationFee); 609: } 610: else { 611: escrow.pay(gov, escrow.balance()); 612: } 613: }
#0 - c4-judge
2022-11-05T21:10:16Z
0xean marked the issue as duplicate
#1 - Simon-Busch
2022-12-05T15:35:12Z
Issue marked as satisfactory as requested by 0xean
🌟 Selected for report: trustindistrust
Also found by: 0xbepresent, Jujic, Lambda, RaoulSchaffranek, c7e7eff, catchup, codexploder, cryptonue, d3e4, eierina, jwood, pashov, peanuts, pedroais, simon135
33.634 USDC - $33.63
https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L78-L84 https://github.com/code-423n4/2022-10-inverse/blob/main/src/DBR.sol#L349-L352
The operator can add as many minter addresses as he/she wants.
81: function addMinter(address minter_) public onlyOperator { 82: minters[minter_] = true; //@audit-issue medium unlimited number of minters can be added. centralisation risk. a compromised minter can overinflate the DBR. 83: emit AddMinter(minter_); 84: }
I believe this presents an important risk as if one of these minter addresses is compromised, unlimited number of DBR can be minted.
Manual review
Consider giving the minter role to only the operator, or have just a single minter rather than multiple.
#0 - c4-judge
2022-11-05T21:31:28Z
0xean marked the issue as duplicate
#1 - Simon-Busch
2022-12-05T15:36:04Z
Issue marked as satisfactory as requested by 0xean
#2 - c4-judge
2022-12-07T08:22:04Z
Simon-Busch marked the issue as duplicate of #301
🌟 Selected for report: rbserver
Also found by: 0x1f8b, 0xNazgul, 0xc0ffEE, 8olidity, Aymen0909, Chom, Franfran, Jeiwan, Jujic, Lambda, M4TZ1P, Olivierdem, Rolezn, Ruhum, TomJ, Wawrdog, __141345__, bin2chen, c7e7eff, carlitox477, catchup, cccz, codexploder, cuteboiz, d3e4, dipp, djxploit, eierina, elprofesor, hansfriese, horsefacts, idkwhatimdoing, imare, immeas, joestakey, ladboy233, leosathya, martin, minhtrng, pashov, peanuts, pedroais, rokinot, rvierdiiev, saneryee, sorrynotsorry, tonisives
0.385 USDC - $0.38
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L6 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L82 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L16
The Chainlink API latestAnswer
used in Oracle.sol is deprecated.
Please check the link.
This function returns 0 when there is no data rather than giving out error.
Also Chainlink may stop supporting the deprecated API one day. In that case prices will not be able to be obtained.
Manual review
Use the latestRoundData function to get the price instead. Add checks on the return data with proper revert messages if the price is stale or the round is uncomplete, for example:
(uint80 roundID, int256 price, , uint256 timeStamp, uint80 answeredInRound) = priceOracle.latestRoundData(); require(answeredInRound >= roundID, "..."); require(timeStamp != 0, "...");
#0 - neumoxx
2022-10-31T08:45:38Z
Duplicate of #601
#1 - c4-judge
2022-11-05T17:50:15Z
0xean marked the issue as duplicate
#2 - Simon-Busch
2022-12-05T15:27:17Z
Issue marked as satisfactory as requested by 0xean
#3 - c4-judge
2022-12-07T08:14:13Z
Simon-Busch marked the issue as duplicate of #584