Platform: Code4rena
Start Date: 03/11/2022
Pot Size: $115,500 USDC
Total HM: 17
Participants: 120
Period: 7 days
Judge: LSDan
Total Solo HM: 1
Id: 174
League: ETH
Rank: 15/120
Findings: 1
Award: $1,909.67
🌟 Selected for report: 1
🚀 Solo Findings: 0
1909.6728 USDC - $1,909.67
https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/modules/credit/LineOfCredit.sol#L143 https://github.com/debtdao/Line-of-Credit/blob/audit/code4rena-2022-11-03/contracts/modules/credit/LineOfCredit.sol#L83-L86
The modifier whileBorrowing()
is used along in the call to LineOfCredit.declareInsolvent(). However this check reverts when count == 0 or credits[ids[0]].principal == 0
. Within the contract, any lender can add credit which adds an entry in credits array, credits[ids].
Assume, when borrower chooses lender positions including credits[ids[0]] to draw on, and repays back the loan fully for credits[ids[1]], then the call to declareInsolvent() by the arbiter would revert since it does not pass the whileBorrowing()
modifier check due to the ids array index shift in the call to stepQ(), which would shift ids[1] to ids[0], thereby making the condition for credits[ids[0]].principal == 0
be true causing the revert.
credits[ids[0]].principal == 0
Manual review
The modifier whileBorrowing() would need to be reviewed and amended.
#0 - c4-judge
2022-11-15T19:04:16Z
dmvt marked the issue as primary issue
#1 - c4-judge
2022-11-17T20:10:08Z
dmvt marked the issue as selected for report
#2 - c4-judge
2022-11-17T20:10:16Z
dmvt changed the severity to 3 (High Risk)
#3 - c4-sponsor
2022-11-30T15:25:08Z
kibagateaux marked the issue as sponsor confirmed
#4 - c4-judge
2022-12-06T17:17:50Z
dmvt marked the issue as satisfactory