Weather Witness

First Flight #40
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: medium
Likelihood: low
Invalid

[EVMNINJA-WW06] Missing Token Existence Check in `performUpkeep()`

Root + Impact

Description

The performUpkeep() function does not check if the token exists before attempting to update its weather data. AlthoughcheckUpkeep() does this check, an attacker could call performUpkeep directly with an invalid token ID.

function performUpkeep(bytes calldata performData) external override {
uint256 _tokenId = abi.decode(performData, (uint256));
// No check if token exists
// ...
}```
## Risk
**Likelihood**:
Low Likelihood
**Impact**:
Medium impact.
## Proof of Concept
```solidity

Recommended Mitigation

Add a token existence check at the beginning of the performUpkeep function:

function performUpkeep(bytes calldata performData) external override {
uint256 _tokenId = abi.decode(performData, (uint256));
// Check if token exists
require(_ownerOf(_tokenId) != address(0), "Token does not exist");
uint256 upkeepId = s_weatherNftInfo[_tokenId].upkeepId;
// ... rest of the function
}
Updates

Appeal created

bube Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

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