Self-settlement via dispatchFrom bypasses refund mechanism allowing underfunded debt settlement
The settlement and force-exercise functions allow a position owner to act as the caller, but the refund mechanism assumes the caller is a distinct third party who can cover any shortage. When the caller is the same as the account, the refund becomes a self-transfer that injects no real value, so settlement can succeed even when the user lacks sufficient real balance to cover the debt.
merlinboii Follow with AnantaDeva and Valves
Originally disclosed on Code4rena
Submitted by merlinboii, also found by AnantaDeva and Valves
PanopticPool.solL1671-L1703PanopticPool.solL1598-L1664
Finding description
The PanopticPool._settlePremium() and PanopticPool._forceExercise() allow position owners to act as the caller (account == msg.sender) via dispatchFrom. However, these flows rely on a refund mechanism that assumes the caller is a distinct third party who can cover any post-settlement shortage.
When account == msg.sender, this assumption breaks because:
CollateralTracker.delegate()inflates the user’s balance with phantom shares (~type(uint248).max), bypassing balance checks during settlement.CollateralTracker.refund()becomes a self-transfer (refund(account, account, ...)) and injects no real value.- Settlement proceeds even when
refundAmounts != 0, meaning a shortage exists that is never actually covered.
This allows settlement to succeed even when the user lacks sufficient real balance to fully cover the debt (interest + premium).
The refund mechanism is designed such that if the target account lacks token0 or token1, the caller supplies the shortage token in exchange for receiving the other token from the target account. The CollateralTracker.refund() explicitly states this assumption:
CollateralTracker.sol L1369-L1382
///...
/// @dev Assumes that the refunder has enough money to pay for the refund.
///...
function refund(address refunder, address refundee, int256 assets) external onlyPanopticPool {
if (assets > 0) {
_transferFrom(refunder, refundee, convertToShares(uint256(assets)));
} else {
uint256 sharesToTransfer = convertToShares(uint256(-assets));
if (balanceOf[refundee] < sharesToTransfer)
revert Errors.NotEnoughTokens(
address(this),
uint256(-assets),
convertToAssets(balanceOf[refundee])
);
_transferFrom(refundee, refunder, sharesToTransfer);
}
}
This assumption fails when refunder == refundee because a self-transfer cannot inject real value to cover the shortage.
During self-settlement, the flow executes as:
delegate() -> settlement -> refund() -> revoke()
Consider the following example:
Let:
B= user’s real balance (shares)I= phantom shares added by delegate (~2^248)X= total shares the settlement attempts to burns = X - B= shortage (s > 0)
During delegation:
balance = B + I (assume B > interestShares)
Settlement burns X shares successfully: Since balance is inflated.
After burn (before revoke): Phantom shares were consumed.
balance = (B + I) - X = I - s
Revoke repair: Because phantom was consumed.
_internalSupply += s
balanceOf[account] = 0
Net supply change:
ΔTS = -X + s = -(B + s) + s = -B
The contract extracts only the user’s real balance B, even though settlement attempted to burn X (where X > B). The remaining shortage s was never funded.
Recommended mitigation steps
Update _settlePremium and _forceExercise to handle self settlement cases so that when account == msg.sender, settlement cannot proceed if the account’s real balance is insufficient to cover the required burn amount.
Refactored part of the
delegate/revokeworkflow.
Status: Mitigation confirmed. Full details in reports from Valves, edoscoba, and Nyx.
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 refund mechanism assumes the caller and the account are different, so a self-transfer cannot inject real value to cover a shortage.
Impact
A user could settle a debt without having enough real balance to cover it, leaving a shortage that is never funded.
What the attacker needed
A position with debt; user can call settlement themselves
The fix
The protocol was mitigated by refactoring part of the delegate/revoke workflow.
How it was found
- The user calls delegate to inflate their balance with phantom shares.
- The user triggers settlement or force exercise as the caller for their own account.
- Settlement burns shares using the inflated balance.
- The refund becomes a self-transfer and injects no real value.
- The user calls revoke to repair the phantom shares, leaving the shortage unfunded.
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 this smart contract, when a user settles a debt, the code expects a separate person (the caller) to pay any missing amount. But the user can call the function themselves, and the code then pretends to pay the missing amount by moving tokens from the user to the user, which does nothing. As a result, the debt is marked as settled even though the user did not actually have enough tokens to pay it.
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.