Skip to content
DoS Audit finding Intermediate

Deny of service in AccountantDelegate.sweepInterest

The sweepInterest function checks that the treasury's cnote balance is zero after redeeming, but this balance can be made non-zero by anyone sending a single cnote token to the treasury. An attacker could permanently block the sweepInterest function, preventing interest from being swept.

0x1f8b Follow

Originally disclosed on Code4rena

Submitted by 0x1f8b, also found by Critical

https://github.dev/Plex-Engineer/lending-market-v2/blob/2646a7676b721db8a7754bf5503dcd712eab2f8a/contracts/Accountant/AccountantDelegate.sol#L101

The sweepInterest method is susceptible to denial of service.

Proof of Concept

The logic of the sweepInterest method relative to the treasury is as follows:

		bool success = cnote.transfer(treasury, amtToSweep);
		if (!success) { revert  SweepError(treasury , amtToSweep); }
		TreasuryInterface Treas = TreasuryInterface(treasury);
		Treas.redeem(address(cnote),amtToSweep);
		require(cnote.balanceOf(treasury) == 0, "AccountantDelegate::sweepInterestError");

As you can see, amtToSweep is passed to it and redeem that amount. Later it is checked that the balance of cnote in the treasury address must be 0. However, all calculations related to amtToSweep come out of the balance of address(this) so if a third party sends a single token cnote to the address of treasury the method will be denied.

Recommended Mitigation Steps

  • Check that the balance is the same after and before the bool success = cnote.transfer(treasury, amtToSweep);

nivasan1 (Canto) confirmed

Alex the Entreprenerd (judge) commented:

The warden has shown how, due to an incorrect invariant (treasury having zero cNote), any griefer can permanently brick the sweepInterest function.

The finding shows how a loss of yield can be achieved, so Medium Severity would be in order.

However, because:

  • an invariant was broken
  • the tokens cannot be withdrawn via an alternative method

I believe High Severity to be more appropriate.


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

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

The function requires the treasury's token balance to be exactly zero after redemption, but an attacker can increase that balance by sending tokens directly, breaking the invariant.

Impact

An attacker could permanently block the sweepInterest function, causing a loss of yield.

What the attacker needed

Attacker can send tokens to treasury

The fix

The fix should check that the treasury's balance is the same before and after the transfer, rather than requiring it to be zero.

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.

A smart contract function tries to move interest tokens and then checks that a particular account (the treasury) has zero balance. Anyone can send a tiny amount of that token to the treasury, making the balance non-zero. This causes the function to always fail, so the interest can never be collected.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0x1f8b

View all

21 more disclosed reports, best first.

More from Canto v2 contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.