Position not deleted after debt paid
A function that settles a debt deletes an entry from a memory copy of an auction stack rather than from storage, so the position is never actually removed. The text claims this leaves stale state behind, though it does not show a concrete attacker action or theft.
Submitted by fs0c, also found by obront and Lotus
In _paymentAH function from LienToken.sol, the stack argument should be storage instead of memory. This bug was also disclosed in the Spearbit audit of this program and was resolved during here: https://github.com/AstariaXYZ/astaria-core/pull/201/commits/5a0a86837c0dcf2f6768e8a42aa4215666b57f11, but was later re-introduced https://github.com/AstariaXYZ/astaria-core/commit/be9a14d08caafe125c44f6876ebb4f28f06d83d4 here. Marking it as high-severity as it was marked as same in the audit.
Proof of Concept
function _paymentAH(
LienStorage storage s,
address token,
AuctionStack[] memory stack,
uint256 position,
uint256 payment,
address payer
) internal returns (uint256) {
uint256 lienId = stack[position].lienId;
uint256 end = stack[position].end;
uint256 owing = stack[position].amountOwed;
//...[deleted lines to show bug]
delete s.lienMeta[lienId]; //full delete
delete stack[position]; // <- no effect on storage
}
The position here is not deleted after the debt is paid as it is a memory pointer.
Recommendation
The first fix can be used again and it would work.
androolloyd (Astaria) commented:
So digging into this more since this payment flow is designed to run only once, and the state is stored inside the clearing house not the lien token, I’m not sure this matters, the deletion of the auction stack should be handled seperately inside the clearing house for the deposit.
SantiagoGregory (Astaria) acknowledged
Picodes (judge) decreased severity to Medium and commented:
The description of the impact of the finding is very brief for this issue and its duplicates.
@androolloyd - the auction stack is in
ClearingHouse, but the issue still stands as it is not deleted inClearingHousealthough it should be, right?
androolloyd (Astaria) commented:
@androolloyd - the auction stack is in
ClearingHouse, but the issue still stands as it is not deleted inClearingHousealthough it should be, right?Yes, it should be.
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 auction stack parameter was declared as memory instead of storage, so the delete only affected a temporary copy.
Impact
The auction position may remain in state after the debt is paid, which the judge treated as a medium-severity issue rather than the high severity originally claimed.
What the attacker needed
A debt payment through the auction flow
The fix
The parameter should be changed to storage, or the deletion should be handled in the clearing house contract; the text says the team acknowledged this.
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 smart contract, data can live permanently on the blockchain (storage) or only temporarily while a function runs (memory). This code edits the temporary copy, so the permanent record is never cleared. The report argues that leftover record should have been removed.
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.