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.
Submitted by 0x1f8b, also found by Critical
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);
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
sweepInterestfunction.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.
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.