Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Valid

Several functions do not reset the `deadline`, leading to premature inheritance activation and fund loss.

Description: The documentation states that in every interaction of the owner with the contract, the deadline should be reset. However, multiple functions fail to update the deadline, leading to inconsistencies in the inheritance logic and potential fund loss.

The affected functions are:

  • removeBeneficiary()

  • createEstateNFT()

  • contractInteractions()

This deviation from the expected behavior could allow the inheritance phase to be triggered prematurely before the contract is fully configured, potentially leading to incorrect distribution of funds and assets.

Impact: Failure to update the deadline in these functions can lead to:

  • Fund loss → If the inheritance phase is triggered before the owner has finalized the contract setup, funds may be incorrectly distributed or permanently lost.

  • Premature inheritance activation → Since the deadline is not extended, the inactivity period continues from the last valid update, allowing beneficiaries to claim the inheritance earlier than expected.

  • Unintended contract behavior → A beneficiary can trigger inheritance before the owner has completed critical adjustments, affecting the distribution of assets.

  • Owner confusion→ The owner may assume they have an additional 90 days after calling these functions, which is not the case.

Proof of Concept: This test demonstrates that calling InheritanceManager::inherit does not require fast-forwarding time again after executing removeBeneficiary(). Since the function does not reset the deadline, the contract remains in a state where the inheritance phase can be prematurely triggered, allowing fund distribution before it should be.

function test_removeBeneficiariesNoSetDeadline() public {
// Define addresses for testing
address emergencyWallet = makeAddr("emergencyWallet");
address alice = makeAddr("alice");
address bob = makeAddr("bob");
// Simulate owner transactions
vm.startPrank(owner);
// Add beneficiaries
im.addBeneficiery(emergencyWallet);
im.addBeneficiery(alice);
im.addBeneficiery(bob);
// 90 days pass since the last interaction
vm.warp(block.timestamp + 90 days);
// The owner calls removeBeneficiary(), expecting the deadline to reset
im.removeBeneficiary(alice);
// Stop acting as the owner
vm.stopPrank();
// Bob, who remains as a beneficiary, attempts to trigger the inheritance phase
vm.prank(bob);
im.inherit();
// Verify that the contract has entered the inheritance phase
assertTrue(im.getIsInherited());
}
Ran 1 test for test/InheritanceManagerTest.t.sol:InheritanceManagerTest
[PASS] test_removeBeneficiariesNoSetDeadline() (gas: 118108)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 7.64ms (418.18µs CPU time)

Tools Used

  • Manual review

  • Foundry for testing

Recommended Mitigation: To maintain contract consistency and ensure the inheritance logic functions as expected, _setDeadline(); should be added to all affected functions.

function removeBeneficiary(address _beneficiary) external onlyOwner {
uint256 indexToRemove = _getBeneficiaryIndex(_beneficiary);
delete beneficiaries[indexToRemove];
+ _setDeadline();
}
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 createEstateNFT(string memory _description, uint256 _value, address _asset) external onlyOwner {
uint256 nftID = nft.createEstate(_description);
nftValue[nftID] = _value;
assetToPay = _asset;
+ _setDeadline();
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

functions do not reset the deadline

Support

FAQs

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