The buy()
function lacks slippage protection, making it vulnerable to MEV (Miner Extractable Value) attacks and sandwich attacks. Since the price is deterministic based on time, malicious actors can predict and manipulate transaction ordering to extract value from users' purchases.
The buy()
function calculates the price at execution time without any bounds checking
MEV bots can sandwich user transactions by:
Front-running with transactions that cause price changes
Including the user's transaction
Back-running to profit from the price movement
Given the deterministic price formula based on time, attackers can precisely calculate profitable attack vectors
Users have no way to specify maximum acceptable price, forcing them to accept any price at execution time
Manual Review
Add a maxPrice parameter to the buy function:
Consider adding a deadline parameter to prevent transactions from staying pending too long
Implement a price oracle with TWAP (Time Weighted Average Price) for more manipulation resistance
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.