Treats
with 1 wei cost, spooked at random = 1 => requiredCost:half-price
are rounded to zero, leading to free tricks.
By predicting random = 1
SpookySwap:trickOrTreat
malicious users can buy Treats
for free, due to divisions are exact in solidity 1/2
will be rounded as 0
, doing so requiredCost
to be 0, enabling free purchases, notice that Treats
can be repriced and traded at higher prices.
This vulnerability only affects 1 wei
per free purchase, it can be though considered as high knowing that along the time it's cumulative, which will affect withdrawFees
.
Manual Review
Foundry Fuzz Testing
Certora (proof rule: users should pay for tricksOrTreats
)
Usage of fixed-point arithmetic
Beware of precision loss
In case of treat, if the cost of the treat is very small, the user can get NFT for zero `requiredCost` due to rounding. Also, if the cost is small and odd, the user may get a given NFT at a lower price than intended.
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.