Reserve accounting breaks fee collection when debt exceeds supply
The reserve-accounting functions assume total supply always covers total borrow, but normal interest accrual can make debt exceed supply. When that happens, reserve queries revert and treasury collection is blocked, leaving fees stuck.
Submitted by v12, also found by DemoreX and volpasec
Found by V12
contracts/kinetic-router/src/calculation.rs#L1225contracts/kinetic-router/src/treasury.rs#L5contracts/kinetic-router/src/calculation.rs#L938
Targets
- KineticRouter::getprotocolreserves
- KineticRouter::collectprotocolreserves
- KineticRouter::calculateinterestratesforreserve
Affected Locations
- KineticRouter.getprotocolreserves: Computes protocol reserves from
total_supply - total_borrowand returnsInvalidAmountwhen debt exceeds supply, even though that state can occur from normal accrual under a positivereserve_factor. - KineticRouter.collectprotocolreserves: Reuses the same
total_borrow > total_supplyassumption during treasury withdrawal, which causes reserve collection to fail whenever the reserve-accounting view reaches that state. - KineticRouter.calculateinterestratesforreserve: Already models
total_debt >= total_supplyas a possible high-utilization state by clamping available liquidity and emittinginsolvent, showing the accounting assumption is inconsistent across the reserve path.
Description
The reserve-accounting path assumes total_supply must stay greater than or equal to total_borrow, and treats the opposite case as an error in both get_protocol_reserves and collect_protocol_reserves. That invariant does not hold in this protocol because borrower debt compounds at the higher borrow rate while supplier balances grow at the lower liquidity rate, with the spread diverted by reserve_factor. As a result, a heavily utilized market can naturally reach total_borrow > total_supply even without any abnormal behavior, especially since protocol fees are not simultaneously reflected by minting corresponding supplier-side claims. Once that happens, the reserve view begins reverting or returning InvalidAmount, and the treasury collection path is bricked by the same check. The implementation should account for this state explicitly, such as zero-clamping available liquidity and limiting collection to actual underlying cash, rather than assuming total_supply - total_borrow must always be positive.
Root Cause
get_protocol_reserves and collect_protocol_reserves rely on the false invariant total_borrow <= total_supply even though the protocol’s interest model allows debt to outgrow supplier claims as reserves accrue.
Impact
Protocol reserve fees become unqueryable and uncollectible for any reserve that enters total_borrow > total_supply, so treasury revenue can remain stuck for an extended period and potentially indefinitely under sustained high utilization. Off-chain automation that relies on the reserve view will also fail during that interval, and any idle cash in the aToken may be unnecessarily frozen because the code rejects the state instead of handling it safely.
Proof of Concept
See this gist for full Proof of Concept
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 reserve functions rely on the false invariant that total borrow never exceeds total supply, even though the interest model allows debt to outgrow supplier claims as reserves accrue.
Impact
Reserve fees become unqueryable and uncollectible for affected reserves, so treasury revenue could remain stuck for an extended period and potentially indefinitely under sustained high utilisation; off-chain automation relying on the reserve view will also fail.
What the attacker needed
A heavily utilised lending market; normal interest accrual over time
The fix
The implementation should handle this state explicitly, for example by zero-clamping available liquidity and limiting collection to actual underlying cash, rather than assuming the difference must be positive.
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 pool, people deposit money (supply) and others borrow it (debt). The code wrongly assumes deposits will always be at least as large as debt. Because interest on debt grows faster than interest paid to depositors, debt can overtake deposits, and then the functions that report and withdraw the protocol's fees stop working.
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.