Single under-funded protocol can break paying off debt
The payOffDebtAll function loops over every protocol and subtracts each one's accrued debt from its balance; if any single protocol lacks funds, the subtraction reverts and the whole transaction fails. Because many core functions require debt to be paid off first, one under-funded protocol can block actions such as setting token price, setting premiums, withdrawing balances and redeeming.
Submitted by cmichel, also found by walker and gpersoon
The SherXERC20.payOffDebtAll function iterates over all protocols of the token. If a single project does not have enough funds to cover the premium payments, the transactions come to a halt, see _payOffDebt:
debt = _accruedDebt(ps, _protocol, _blocks);
// this can revert tx
ps.protocolBalance[_protocol] = ps.protocolBalance[_protocol].sub(debt);
Many core functions require paying off debt first and can therefore revert when a single protocol cannot pay the token premium:
setTokenPricesetProtocolPremiumwithdrawProtocolBalanceredeem- etc.
This scenario that a protocol is unable to pay a premium does not seem unlikely especially as there can be many protocols and each protocol can pay premiums in potentially many tokens and have to continuously re-deposit to their account to increase the balance. It is also rather involved to remove the protocol’s coverage and remove the premium payments for the token. It requires governance interaction and potentially paying for the accumulated debt themselves.
Evert0x (Sherlock) acknowledged:
This was a design tradeoff. As governance we can see it coming as the balance is slowly draining. But the fact the protocols are able to withdraw the full amount at any time could surprise the governance. (and make the reverts in the functions above happening)
We are thinking to add a rule in the
withdrawProtocolBalanceto only allow withdrawals with at least 2 days of remaining balance. Allowing enough time for governance calls to remove the protocol.
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 debt-settlement loop performs an unchecked subtraction per protocol inside a single transaction, so one insufficient balance reverts the entire batch instead of being skipped or handled.
Impact
A single protocol that cannot pay its premium could halt core functions such as setting the token price, setting premiums, withdrawing balances and redeeming, and removing that protocol requires governance action and possibly paying the debt itself.
What the attacker needed
At least one protocol with insufficient balance; core function that pays off debt first
The fix
The team considered requiring withdrawals to leave at least two days of remaining balance, giving governance time to remove a protocol before it runs dry.
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 keeps a balance for each protocol that owes it money. When it tries to collect from all of them at once, one account with too little money makes the whole collection fail, like a group payment that fails because one person's card is declined. That failure then stops other important actions that first need all debts settled.
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.