Trick or Treat

First Flight #27
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Treat cost may change between trickOrTreat and resolveTrick functions calls, leading to incorrect required payment amount

Summary

Price of a treat may be changed after user swaps the treat with double price and before the user calls SpookySwap::resolveTrick. In that case the final price the user pays is incorrect.

Vulnerability Details

The contract owner can change cost of a treat using function SpookySwap::setTreatCost. If there are pending tokens with the treat, the price in SpookySwap::resolveTrick will be calculated based on the new cost, because the required cost is calculated as below:

uint256 requiredCost = treat.cost * 2;

If the treat cost changed to higher value after a user gets the treat for double-price, then the user must pay more than required when calling SpookySwap::resolveTrick, because the required payment is recalculated based on the current cost.

Impact

User pays incorrect amount for a treat.

Tools Used

Manual review

Recommendations

Consider to store remaining payment amount instead of paid amount for pending treats.

Updates

Appeal created

bube Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

[invalid] Change cost between the call of trickOrTreat and resolveTrick

Only the owner has the rights to change the cost of the treat. Therefore it is assumed that the owner will not change the cost of the pending NFTs. The owner role is trusted.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.