The fulfillMintRequest function in `WeatherNft` contract is publicly accessible without access control. This function completes the minting process based on a Chainlink request ID (bytes32 requestId) and calls _mint with the msg.sender as the recipient. However, any external user can call this function with a valid request ID.
>@audit function requestMintWeatherNFT(
string memory _pincode,
string memory _isoCode,
bool _registerKeeper,
uint256 _heartbeat,
uint256 _initLinkDeposit
) external payable returns (bytes32 _reqId) {
require(
msg.value == s_currentMintPrice,
WeatherNft__InvalidAmountSent()
);
s_currentMintPrice += s_stepIncreasePerMint;
if (_registerKeeper) {
IERC20(s_link).safeTransferFrom(
msg.sender,
address(this),
_initLinkDeposit
);
}
_reqId = _sendFunctionsWeatherFetchRequest(_pincode, _isoCode);
emit WeatherNFTMintRequestSent(msg.sender, _pincode, _isoCode, _reqId);
s_funcReqIdToUserMintReq[_reqId] = UserMintRequest({
user: msg.sender,
pincode: _pincode,
isoCode: _isoCode,
registerKeeper: _registerKeeper,
heartbeat: _heartbeat,
initLinkDeposit: _initLinkDeposit
});
}
Unauthorized minting of NFTs.
Incorrect ownership of tokens.
Replay vulnerability by reusing a known requestId.
Can potentially inflate token supply or steal LINK funds deposited for automation.
+ add this require(
msg.sender == s_funcReqIdToUserMintReq[requestId].user,
"Only original requester can fulfill mint"
);