Skip to content
Business logic Audit finding Intermediate

governor can permanently prevent withdrawals in spite of being restricted

The governor can set the interest rate model to return zero interest even at high utilisation, which removes the incentive for borrowers to repay and could prevent lenders from withdrawing their funds. This contradicts the stated restriction that the governor should not be able to prevent withdrawals.

roguereddwarf Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-10-aloe-judging/issues/35

Found by

roguereddwarf According to the Contest README (which is the highest order source of truth), the governor address should be restricted and not be able to prevent withdrawals from the Lenders.

This doesn't hold true. By setting the interest rate that the borrowers have to pay to zero, the governor can effectively prevent withdrawals.

Vulnerability Detail

Quoting from the Contest README:

Text
Is the admin/owner of the protocol/contracts TRUSTED or RESTRICTED?

Restricted. The governor address should not be able to steal funds or prevent users from withdrawing. It does have access to the govern methods in Factory, and it could trigger liquidations by increasing nSigma. We consider this an acceptable risk, and the governor itself will have a timelock.

The mechanism by which users are ensured that they can withdraw their funds is the interest rate which increases with utilization.

Market forces will keep the utilization in balance such that when users want to withdraw their funds from the Lender contracts, the interest rate increases and Borrowers pay back their loans (or get liquidated).

What the governor is allowed to do is to set a interest rate model via the Factory.governMarketConfig function.

The SafeRateLib is used to safely call the RateModel by e.g. handling the case when the call to the RateModel reverts and limiting the interest to a MAX_RATE: https://github.com/aloelabs/aloe-ii/blob/c71e7b0cfdec830b1f054486dfe9d58ce407c7a4/core/src/RateModel.sol#L38-L60.

This clearly shows that the governor should be very much restricted in setting the RateModel such as to not damage users of the protocol which is in line with how the governor role is described in the README.

However the interest rate can be set to zero even if the utilization is very high. If Borrowers can borrow funds for a zero interest rate, they will never pay back their loans. This means that users in the Lenders will never be able to withdraw their funds.

It is also noteworthy that the timelock that the governor uses won't be able to prevent this scenario since even if users withdraw their funds as quickly as possible, there will probably not be enough time / availability of funds for everyone to withdraw in time (assuming a realistic timelock length).

Impact

The governor is able to permanently prevent withdrawals from the Lenders which it should not be able to do according to the contest README.

Code Snippet

Function to set the rate model:
https://github.com/aloelabs/aloe-ii/blob/c71e7b0cfdec830b1f054486dfe9d58ce407c7a4/core/src/Factory.sol#L282-L303

SafeRateLib allows for a zero interest rate:
https://github.com/aloelabs/aloe-ii/blob/c71e7b0cfdec830b1f054486dfe9d58ce407c7a4/core/src/RateModel.sol#L38-L60

Tool used

Manual Review

Recommendation

The SafeRateLib should ensure that as the utilization approaches 1e18 (100%), the interest rate cannot be below a certain minimum value.

This ensures that even if the governor behaves maliciously or uses a broken RateModel, Borrowers will never borrow all funds without paying them back.

Discussion

sherlock-admin2

2 comment(s) were left on this issue during the judging contest.

panprog commented:

low, because even zero interest rates still enforce higher deposit than borrow, so there is still incentive for borrowers to return funds. 0 rate doesn't really lock the funds, just makes incentive to return them smaller, but I think it's still allowed according to protocol docs/rules, so is probably intended possibility.

MohammedRizwan commented:

invalid as governor actions are timelocked

panprog

Escalate

I don't think this should be Medium, it's more info/low, because apparently 0 rates are allowed by the protocol which is the design decision and like I've mentioned in comments, there is still incentive to repay the borrow. I believe the following statements:

By setting the interest rate that the borrowers have to pay to zero, the governor can effectively prevent withdrawals.

If Borrowers can borrow funds for a zero interest rate, they will never pay back their loans.

are incorrect. Governor can't prevent withdrawals. Governor can make it less attractive to withdraw, but can't prevent it. Borrowers can still repay their loans for different reasons, including their price risk, their requirements for collateral etc.

Also, I don't think it's possible to come up with any valid low limit for high utilization - setting this too low (like 0.01% or even 1%) will not change anything significantly for high volatility tokens. Setting this too high might be too high for, say, some stablecoins.

So my point is that 0 rates certainly create less incentive to repay loans, but it doesn't prevent repayments and it's hard to fix anyway.

sherlock-admin2

Escalate

I don't think this should be Medium, it's more info/low, because apparently 0 rates are allowed by the protocol which is the design decision and like I've mentioned in comments, there is still incentive to repay the borrow. I believe the following statements:

By setting the interest rate that the borrowers have to pay to zero, the governor can effectively prevent withdrawals.

If Borrowers can borrow funds for a zero interest rate, they will never pay back their loans.

are incorrect. Governor can't prevent withdrawals. Governor can make it less attractive to withdraw, but can't prevent it. Borrowers can still repay their loans for different reasons, including their price risk, their requirements for collateral etc.

Also, I don't think it's possible to come up with any valid low limit for high utilization - setting this too low (like 0.01% or even 1%) will not change anything significantly for high volatility tokens. Setting this too high might be too high for, say, some stablecoins.

So my point is that 0 rates certainly create less incentive to repay loans, but it doesn't prevent repayments and it's hard to fix anyway.

You've created a valid escalation!

To remove the escalation from consideration: Delete your comment.

You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.

roguereddwarf

@panprog

What a zero interest rate allows is to gain leverage on your funds (collateral) for free. Imagine a bank where you can deposit $100 to then be able to get $500 and invest in stocks without ever having to pay that back.

It is true that a borrower might no longer want to participate in borrowing:

including their price risk, their requirements for collateral etc.

But then another borrower may just immediately take up the funds again (-> front-running since there is a for-profit incentive to do so).

But these are edge cases. In reality all funds from the Lender will just be used by Borrowers, meaning utilization will be 100%.

According to the README this must not be possible.

Beyond that, the "hard to fix" objection of yours seems invalid to me


Also, I don't think it's possible to come up with any valid low limit for high utilization - setting this too low (like 0.01% or even 1%) will not change anything significantly for high volatility tokens. Setting this too high might be too high for, say, some stablecoins.

So my point is that 0 rates certainly create less incentive to repay loans, but it doesn't prevent repayments and it's hard to fix anyway.

You can easily enforce a check that at a utilization rate of say 99%, that the interest rate cannot go below x%. So all we need to do is to determine a cutoff for utilization where we enforce x% of minimum interest rate. x% just needs to be very costly. And since we only enforce it starting from 99% we can still have interest rates based on the specific pair for all utilization ratios from 0% to 99%.

haydenshively

My view on this is that if governance sets a rate model that returns 0% interest (intentionally or otherwise), interested parties could create repayment incentives exogenous to the protocol. For example, "Borrowers commit to close their positions by signing X. Lenders commit to give those Borrowers a rebate Y. Past some participation threshold Z, commitments are processed atomically and participating lenders receive (1 - Y)% of their funds."

Obviously this is roundabout and lossy, but I don't want to hardcode any utilization → interest rate relationships into the SafeRateLib. I'm hoping to implement PID-controlled rates in the future, and boundary conditions could make that difficult.

I don't have an opinion on severity; just thought I'd explain why we're not going to fix it.

roguereddwarf

I understand. I still stick to my assessment of "Medium" severity as

  1. not being able to withdraw shouldn't be possible according to README
  2. the "fix" would create a loss due to having to pay the incentives. Also this is an argument of the kind "not a big deal if we get hacked, we just pay the hacker and we're fine"

cvetanovv

I think this issue should stay Medium. The sponsor confirmed the issue at the beginning and doesn't have a problem with being medium. Also in the README admin/owner is RESTRICTED.

Trumpero

Planning to reject escalation and keep this issue medium because admin/owner is RESTRICTED in the contest readme.

Czar102

Result: Medium Unique

sherlock-admin2

Escalations have been resolved successfully!

Escalation status:

The original report as published on Sherlock, by roguereddwarf. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the interest rate model allows a zero interest rate even at high utilisation, removing the economic incentive for borrowers to repay.

Impact

The governor could permanently prevent withdrawals from the lenders, which the README says should not be possible.

What the attacker needed

Governor role; governor sets zero interest rate model

The fix

The SafeRateLib should enforce a minimum interest rate as utilisation approaches 100%.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In a lending protocol, people deposit money (lenders) and others borrow it (borrowers). Normally, when many people want to withdraw, the interest rate goes up, encouraging borrowers to repay so lenders can get their money back. Here, the governor (an admin role) can set the interest rate to zero, so borrowers have no reason to repay, and lenders may be stuck.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by roguereddwarf

View all

12 more disclosed reports, best first.

More from Aloe

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.