Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Appoint Trustee Allows Zero Address

Summary

The appointTrustee function in the InheritanceManager contract does not validate the provided trustee address, allowing it to be set to the zero address.

Vulnerability Details

By not checking for a non-zero address in the appointTrustee function, the contract permits the trustee role to be assigned to address(0). This misconfiguration can lead to unintended behavior in subsequent trustee-related functions, such as asset valuation and buyout processes, as the zero address cannot perform trustee actions.

Impact

Indirect Impact: This issue creates a risk of misconfiguration, potentially disabling trustee functionality. However, it does not directly allow fund theft.

Tools Used

Manual review

Foundry (Forge) unit tests demonstrating that the trustee can be set to address(0)

Recommendations

Add a validation check in the appointTrustee function to ensure that the provided trustee address is not the zero address.

Update the function’s documentation to clarify acceptable trustee addresses.

PoC

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
import {Test} from "forge-std/Test.sol";
import {InheritanceManager} from "../src/InheritanceManager.sol";
import {ERC20Mock} from "@openzeppelin/contracts/mocks/token/ERC20Mock.sol";
contract InheritanceManagerVulnerabilityTest is Test {
InheritanceManager im;
ERC20Mock usdc;
ERC20Mock weth;
address owner = makeAddr("owner");
address beneficiary1 = makeAddr("beneficiary1");
address beneficiary2 = makeAddr("beneficiary2");
address attacker = makeAddr("attacker");
uint256 public constant INITIAL_SUPPLY = 1000e18;
uint256 public constant ASSET_VALUE = 100e18;
function setUp() public {
vm.prank(owner);
im = new InheritanceManager();
// Deploy mocks with an initial supply for testing
usdc = new ERC20Mock();
weth = new ERC20Mock();
usdc.mint(owner, INITIAL_SUPPLY);
weth.mint(owner, INITIAL_SUPPLY);
}
function test_appointTrusteeZeroAddress() public {
vm.startPrank(owner);
im.addBeneficiery(beneficiary1);
im.addBeneficiery(beneficiary2);
vm.stopPrank();
vm.warp(3600);
vm.warp(1 + 90 days);
vm.prank(beneficiary1);
im.inherit();
vm.prank(beneficiary1);
im.appointTrustee(address(0));
address trustee = im.getTrustee();
assertEq(
trustee,
address(0),
"Trustee should be allowed to be the zero address"
);
}
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
0xtimefliez Lead Judge 3 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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