HorseStore.sol
has a vulnerability where a non-existent horse can be fed and considered happy, even though it doesn't exist. Furthermore, when a horse with the non-existing ID is actually minted, it's considered happy even though it hasn't been fed.
The vulnerability lies in the feedHorse()
and isHappyHorse()
functions. feedHorse()
doesn't check for input validity (e.g. if the horse exists before feeding it). As a result, it's possible to feed a non-existent horse. isHappyHorse()
also doesn't check if the horse exists before checking its happiness. This means a non-existent horse can be considered happy.
Given the invariant:
If horse X has been fed within the past 24 hours, horse X must be happy <=> If horse X has NOT been fed within the past 24 hours, horse X must NOT be happy!
There is at least one scenario where the invariant can be broken:
Manual review
Validate feedHorse()
and isHappyHorse()
inputs:
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.