The buyOutEstateNFT
function in the InheritanceManager contract lacks reentrancy protection despite making external calls to potentially arbitrary token contracts. While standard ERC20 implementations typically cannot reenter, this could be exploited if a malicious or non-standard token is used as the payment asset.
The function makes external calls via safeTransferFrom
and safeTransfer
without the nonReentrant
modifier that is applied to other sensitive functions in the contract:
This function could potentially be vulnerable because:
It relies on external token contract behavior which varies by implementation
While standard ERC20 tokens cannot typically reenter, non-standard or malicious tokens could implement callbacks within their transfer functions
State changes (NFT burning) occur after external calls
There's no check to prevent the same NFT from being bought out multiple times if a reentrancy were possible
If a malicious or non-standard token is used as assetToPay
, it could potentially:
Implement callbacks in transfer functions that reenter the contract
Manipulate the distribution of funds to beneficiaries
Possibly prevent the NFT from being properly burned
Disrupt the inheritance process
The severity is medium because:
It requires a malicious or non-standard token implementation to exploit
Standard, trusted ERC20 tokens would not be vulnerable
It contradicts the security pattern applied to other functions in the contract
Defense-in-depth principles suggest adding protection regardless
Manual code review
Add the nonReentrant
modifier to the function and follow the Checks-Effects-Interactions pattern by updating state before making external calls:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.