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

Multiple methods in `InheritanceManager.sol` do not call `InheritanceManager.sol:_setDeadline()`

[L-1] Multiple methods in InheritanceManager.sol do not call InheritanceManager.sol:_setDeadline()

Description: All owner interactions with the InheritanceManager.sol contract should trigger the deadline to be reset for 90 days. This is done by calling InheritanceManager.sol:_setDeadline() at the end of each function.
Missing functions are contractInteractions(), createEstateNFT(), and removeBeneficiary().
Anytime the contract owner calls any of these functions, the deadline will not be reset and the beneficiaries would have access to the funds/NFTs before the intended time-lock period.

Impact: Beneficiaries would have access to the funds/NFTs before the intended time-lock period is over.

Proof of Code:

Code Solidity test in Remix.
function beforeAll () public {
inheritanceManager = new InheritanceManager();
}
function timelockNotUpdated() public {
Assert.equal(inheritanceManager.getDeadline(), 0, "deadline has been updated");
inheritanceManager.addBeneficiery(0x514910771AF9Ca656af840dff83E8264EcF986CA);
uint256 dl = inheritanceManager.getDeadline();
inheritanceManager.createEstateNFT("nft1", 10, USDC);
inheritanceManager.removeBeneficiary(0x514910771AF9Ca656af840dff83E8264EcF986CA);
Assert.equal(inheritanceManager.getDeadline(), dl, "deadline has been updated");
}

Recommended Mitigation: At the end of each function contractInteractions(), createEstateNFT(), and removeBeneficiary(), call _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 3 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.