settleAuction() Check for status errors
The settleAuction function uses an incorrect logical condition (AND instead of OR) when checking auction state, so it can proceed even when there is no bid. This allows ClearingHouse.safeTransferFrom() to execute successfully without a valid auction.
Submitted by bin2chen, also found by kaden
ClearingHouse.safeTransferFrom() to execute successfully even if there is no bid.
Proof of Concept
settleAuction is called at the end of the auction and will check if the status is legal
function settleAuction(uint256 collateralId) public {
if (
s.collateralIdToAuction[collateralId] == bytes32(0) &&
ERC721(s.idToUnderlying[collateralId].tokenContract).ownerOf(
s.idToUnderlying[collateralId].tokenId
) !=
s.clearingHouse[collateralId]
) {
revert InvalidCollateralState(InvalidCollateralStates.NO_AUCTION);
}
This check seems to be miswritten,The normal logic would be
s.collateralIdToAuction[collateralId] == bytes32(0) || ERC721(s.idToUnderlying[collateralId].tokenContract).ownerOf(
s.idToUnderlying[collateralId].tokenId
) == s.clearingHouse[collateralId]
This causes ClearingHouse.safeTransferFrom() to execute successfully even if there is no bid.
Recommended Mitigation Steps
function settleAuction(uint256 collateralId) public {
if (
- s.collateralIdToAuction[collateralId] == bytes32(0) &&
- ERC721(s.idToUnderlying[collateralId].tokenContract).ownerOf(
- s.idToUnderlying[collateralId].tokenId
- ) !=
- s.clearingHouse[collateralId]
+ s.collateralIdToAuction[collateralId] == bytes32(0) ||
+ ERC721(s.idToUnderlying[collateralId].tokenContract).ownerOf(s.idToUnderlying[collateralId].tokenId
+ ) ==
+ s.clearingHouse[collateralId]
) {
revert InvalidCollateralState(InvalidCollateralStates.NO_AUCTION);
}
androolloyd (Astaria) confirmed
Keeping medium severity despite the lack of clear impact, the lack of clear impact being due to flaws in the flow before these lines.
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 condition uses logical AND instead of OR, so the revert only triggers when both sub-conditions are true rather than either one.
Impact
The auction settlement can proceed without a bid, allowing ClearingHouse.safeTransferFrom() to execute successfully; the judge kept medium severity despite the lack of clear impact.
What the attacker needed
None
The fix
The condition should be changed to use logical OR and compare ownership with equality, as shown in the recommended mitigation.
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, a function that ends an auction checks two things with 'AND' when it should use 'OR'. Because of this mistake, the function can run even when there is no bid, letting a transfer happen when it should not.
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.