Open sherlock-admin2 opened 9 months ago
1 comment(s) were left on this issue during the judging contest.
takarez commented:
valid: utilization should be mitigated; high(6)
The protocol team fixed this issue in PR/commit https://github.com/arcadia-finance/lending-v2/pull/137.
This should be high as it can steal both the first subsequent deposit and all future deposits after that. The original linked issue for Silo Finance was Critical although Silo had multiple simultaneous pools. The interest rate formula for both Silo and Arcadia are the same, but that POC was more optimised which shows a faster rate of massive interest accrual.
You've deleted an escalation for this issue.
Hi @Banditx0x I believe the following factors mentioned by @zzykxx in his report warrants the decrease in severity:
- The interest rate is capped at 2^80 (~= 10^24) because of the downcasting in LendingPool::_calculateInterestRate(). The maximum interest is about 100% every 20 days.
- The tokens sent directly to the pool by the griefer are effectively lost and can be transferred to the treasury.
- The virtual shares implementation in the tranches might prevent the attacker from collecting all of the interest.
Sponsors Comments:
impact is only possible in quasi empty pools, and cost for doing it is largely in line with the damage done. In the example of 93, only 100 assets are in the pool, 1e18 are donated by the attacker → only the user borrowing the 100 assets is affected, so in this case of an empty pool, not a lot, and even more, the 1e18 can indeed be borrowed by the attacker, but he’ll be liquidated and incur a loss himself: he is the one paying the interest he jacked up (even if only >100 is recovered through liquidations, the LP actually profits, since the penalty is paid on a larger amount than what the “good” lp borrowed out). → low probability, cost is high → medium at most
Hey @Banditx0x, correct me if I'm wrong, but I think the following applies here:
uint80
=~ 10^24
.updateInterestRate()
the interest rate will diminish the speed at which it increases.Some damage can be caused by abusing this issue, but I think the damage is not big enough to classify this as high severity. Of course, I would be more than happy to be proven wrong since this would also be in my personal interest.
@zzykxx thanks for the response. You're right that the Silo finance situation had much higher impact due to manipulation of one asset allowing borrows of another. However I had originally thought that the impact would be High even with this in mind as it had the same impact as the share inflation attack which historically has had high severity.
I hadn't realised the maximum interest rate was capped at uint80
, which indeed caps the interest rate to far lower than the issue I had linked.
Given the slower interest rate accrual than I originally thought, I agree with the medium severity.
Edit: i deleted past escalation comment due to this discussion. Just so this conversation makes sense for future readers.
Planning to reject the escalation and leave the issue as is.
Result: Medium Has duplicates
Wasn't the escalation deleted before the period end?
Banditx0x's comment was last edited on 5:26AM UTC, while the escalation period end was 12:36PM same day.
@midori-fuse It looks so, we will look into it. Thank you for bringing this up!
The escalation should have been deleted, there was an issue on Sherlock's part that's now resolved.
Fix looks good. Utilization is now capped at 100%
The Lead Senior Watson signed off on the fix.
Bandit
high
Utilisation Can Be Manipulated Far Above 100%
Summary
The utilisation of the protocol can be manipulated far above 100% via token donation. It is easiest to set this up on an empty pool. This can be used to manipulate the interest to above 10000% per minute to steal from future depositors.
Vulnerability Detail
This attack is inspired by / taken from this bug report for Silo Finance. I recommend reading it as is very well written: https://medium.com/immunefi/silo-finance-logic-error-bugfix-review-35de29bd934a
The utilisation is basically _assets_borrowed / assetsloaned. A higher utilisation creates a higher interest rate. This is assumed to be less than 100%. However if it exceeds 100%, there is no cap here:
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/lending-v2/src/LendingPool.sol#L809-L817
Normally, assets borrowed should never exceed assets loaned, however this is possible in Arcadia as the only thing stopping a borrow exceeding loans is that the
transfer
of tokens will revert due to not enough tokens in theLending pool
. However, an attacker can make it not revert by simply sending tokens directly into the lending pool. For example using the following sequence:1e18
assets into theLendingPool
1e18
assetsThese are the first steps of the coded POC at the bottom of this issue. It uses a token donation to make a borrow which is far larger than the loan amount.
In the utilisation calculation, this results in a incredibly high utilisation rate and thus interest rate as it is not capped at 100%. This is why some protocols implement a hardcap of utilisation at 100%.
The interest rate is so high that over 2 minutes, 100 assets grows to over100000 assets, or a 100000% interest over 2 minutes. The linked similar exploit on Silo Finance has an even more drastic interest manipulation which could drain the whole protocol in a block. However I did not optimise the numbers for this POC.
Note that the 1e18 assets "donated" to the protocol are not lost. They can simply be all borrowed into an attackers account.
The attacker can set this up when the initial lending pool is empty. Then, they can steal assets from subsequent depositors due to the huge amount of interest collected from their small initial deposit
Let me sum up the attack in the POC:
1e18
assets into theLendingPool
1e18
assetsHere is the output from the console.logs:
This is the edited version of
setUp()
in_scenario.t.sol
This test was added to
BorrowAndRepay.scenario.t.sol
Impact
An early depositor can steal funds from future depositors through utilisation/interest rate manipulation.
Code Snippet
https://github.com/sherlock-audit/2023-12-arcadia/blob/main/lending-v2/src/LendingPool.sol#L809-L817
Tool used
Manual Review
Recommendation
Add a utilisation cap of 100%. Many other lending protocols implement this mitigation.