Open c4-bot-4 opened 9 months ago
hansfriese marked the issue as primary issue
fez-init (sponsor) acknowledged
fez-init marked the issue as disagree with severity
This should be QA.
QA is more appropriate.
hansfriese changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/code-423n4/2024-01-init-capital-invitational/blob/a01c4de620be98f9e57a60cf6a82d4feaec54f58/contracts/core/InitCore.sol#L392 https://github.com/code-423n4/2024-01-init-capital-invitational/blob/a01c4de620be98f9e57a60cf6a82d4feaec54f58/contracts/core/InitCore.sol#L380
Vulnerability details
Impact
Overpaid asset in locked when flashloan
Proof of Concept
When flashloan, in this end to code check if the lending pool balance is greater than the consumed balance before flashloan
https://github.com/code-423n4/2024-01-init-capital-invitational/blob/a01c4de620be98f9e57a60cf6a82d4feaec54f58/contracts/core/InitCore.sol#L392
the problem is that in case when user over-pay flashloan,
suppose user flash loan 10000 USDC and then repay 10100 USDC, the 100 USDC is lost and locked in the lending pool because the internal accounting of lending pool use cashAmount to track avaiable balance
but the code above, does not update cash amount after flashloan is finished
Tools Used
Manually review
Recommended Mitigation Steps
while I understand this is an mitigation for finding
https://github.com/code-423n4/2023-12-initcapital-findings/issues/3
the issue above can be resolved (issue 3)
https://github.com/code-423n4/2024-01-init-capital-invitational/blob/a01c4de620be98f9e57a60cf6a82d4feaec54f58/contracts/core/InitCore.sol#L380
when setModeStatus.canCollateralize and can.Borrow to false
https://github.com/code-423n4/2024-01-init-capital-invitational/blob/a01c4de620be98f9e57a60cf6a82d4feaec54f58/contracts/core/Config.sol#L136
disable all flashloan for all the pool that belongs to a mode
and sync the lending pool balance even user overpays flashloan
Assessed type
Access Control