Description:
Multiple owner-controlled functions fail to reset the inactivity timer (_setDeadline()
), which is intended to prevent premature inheritance claims. This timer should be reset whenever the owner interacts with the contract to indicate they are still active. However, the following functions are missing this crucial call:
contractInteractions()
removeBeneficiary()
createEstateNFT()
Impact:
If the owner primarily uses these functions for contract interaction while neglecting other functions that do reset the timer, the contract may enter the inherited state prematurely, allowing beneficiaries to claim assets even though the owner is still active. This directly undermines the core security mechanism of the contract.
Code Location:
function contractInteractions(address _target, bytes calldata _payload, uint256 _value, bool _storeTarget)
external
nonReentrant
onlyOwner
{
(bool success, bytes memory data) = _target.call{value: _value}(_payload);
require(success, "interaction failed");
if (_storeTarget) {
interactions[_target] = data;
}
}
function removeBeneficiary(address _beneficiary) external onlyOwner {
uint256 indexToRemove = _getBeneficiaryIndex(_beneficiary);
delete beneficiaries[indexToRemove];
}
function createEstateNFT(string memory _description, uint256 _value, address _asset) external onlyOwner {
uint256 nftID = nft.createEstate(_description);
nftValue[nftID] = _value;
assetToPay = _asset;
}
Recommendation:
Add the _setDeadline()
function call at the end of each owner-controlled function to reset the inactivity timer:
function contractInteractions(address _target, bytes calldata _payload, uint256 _value, bool _storeTarget)
external
nonReentrant
onlyOwner
{
(bool success, bytes memory data) = _target.call{value: _value}(_payload);
require(success, "interaction failed");
if (_storeTarget) {
interactions[_target] = data;
}
_setDeadline();
}
function removeBeneficiary(address _beneficiary) external onlyOwner {
uint256 indexToRemove = _getBeneficiaryIndex(_beneficiary);
delete beneficiaries[indexToRemove];
_setDeadline();
}
function createEstateNFT(string memory _description, uint256 _value, address _asset) external onlyOwner {
uint256 nftID = nft.createEstate(_description);
nftValue[nftID] = _value;
assetToPay = _asset;
_setDeadline();
}
```ww
## Tools Used
- Foundry Testing Framework
- Manual Code Review