Two users deposit the same amount into a vault, withdraw the same amount a year later, and burn a different number of shares to do it. That was the result of a High I found in the Liquid Ron contest on Code4rena in January 2025, and the cause was an operator fee that stayed in the vault's books after it was already owed.
This is part of the series where I go back through my past contest findings one at a time: the bug, the assumption behind it, and what to look for so the pattern stands out faster next time.
How the share price is set
Liquid Ron is liquid staking for RON on the Ronin chain. You deposit, the vault delegates your funds to validators through staking proxies, and the rewards auto-compound. In return you hold shares, and each share is worth a slice of everything the vault holds.
That slice comes from one ratio: total shares against totalAssets(), the function that reports how much the vault holds on behalf of depositors. Every deposit and every withdrawal is priced off it.
That gives you the invariant worth writing down before reading anything else:
The share price should only move when what depositors actually own moves.
If the price can change for any other reason, then some users get a better deal than others, and the difference comes out of another user's pocket.
Where the fee sits
The vault takes an operator fee on the rewards it earns. When the operator harvests, the fee is booked like this:
function harvest(uint256 _proxyIndex, address[] calldata _consensusAddrs) external onlyOperator whenNotPaused {
uint256 harvestedAmount = ILiquidProxy(stakingProxies[_proxyIndex]).harvest(_consensusAddrs);
operatorFeeAmount += (harvestedAmount * operatorFee) / BIPS;
emit Harvest(_proxyIndex, harvestedAmount);
}
The fee is recorded in operatorFeeAmount, but the funds it represents stay in the vault until someone calls fetchOperatorFee(), the function that sends the accrued fee to the operator. Until that call happens, totalAssets() still counts those funds.
So between a harvest and a fetch, the vault reports more assets than depositors actually own, because part of that total already belongs to the operator and simply has not left yet.
What it does to two users
The proof of concept in my submission walks through exactly this.
Bob and Alice each deposit 10,000. A year passes and the operator harvests, so a fee is now owed but has not been fetched.
- Bob withdraws 100.
totalAssets()is inflated by the unfetched fee, so each share looks worth a little more, and he burns fewer shares to get his 100. - The operator fetches the fee, and
totalAssets()drops. - Alice withdraws the same 100. Each share is now worth less, so she burns more shares for the same amount.
Bob and Alice made the same deposit and the same withdrawal, but they paid different prices, and the only thing that separated them was which side of fetchOperatorFee() they landed on.
The test ends on exactly that:
assertGt(sharesBurnedAfter, sharesBurnedBefore);
Because the fee is fetched manually, the gap is not fixed either. The longer fees pile up between fetches, the further apart the two prices drift, and the more the users who withdraw early are subsidised by the users who withdraw after them.
The full writeup, with the complete test, is on my audits page.
The fix
totalAssets() should only ever count what depositors can actually claim. Either collect the fee automatically on a fixed schedule so it cannot build up, or exclude the accrued fee from totalAssets() so the exchange rate never includes money that is already owed to the operator.
How to spot it
Nothing in harvest is wrong on its own. The fee calculation is correct, and so is the variable that tracks it. The bug lives in the gap between two functions that are each correct, and that gap has a shape you can look for.
Any time a protocol records an obligation in one place and leaves the funds sitting somewhere else, ask:
- Does the asset total still count money that is already owed to someone?
- Who can call the function that settles it, and how often does it really get called?
- What can a user do in the window between "owed" and "paid"?
- Does any price, ratio or share calculation read the total during that window?
Operator fees, protocol revenue, pending withdrawals and unclaimed rewards all follow this pattern of being recorded now and moved later, and the invariant breaks in the time between. You do not need an attacker for it either, because ordinary users withdrawing at ordinary times are enough to move value from one of them to the other.
If your vault or staking protocol books fees or rewards before it moves them, that window is worth a careful look. I am taking on reviews. Get in touch.
