The purchase()
function in Swan.sol allows price manipulation and asset state inconsistencies through reentrancy during token transfers.
State changes before external calls break the Checks-Effects-Interactions pattern
Multiple token transfers after state changes enable:
Reentrancy attacks through malicious tokens
Price manipulation during the transaction
Asset state inconsistencies
No atomicity guarantees between status updates and transfers
Potential double-spend scenarios if reentered
Attacker could:
Initiate purchase
Status updates to Sold
Reenter through token callbacks
Execute another purchase or manipulate price
Complete original transaction with stale data
This puts both asset transfers and payments at risk of manipulation, potentially leading to loss of funds or assets for the protocol.
Price manipulation during purchase
Asset state inconsistencies
Potential double spending
Loss of funds for buyers/sellers
Causes:
Violation of CEI pattern
No reentrancy guard despite multiple external calls
Non-atomic state updates and transfers
Manual Review
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.