with a sequence of steps and combining a couple of vulnerabilities a malicouesly appointed beneficiary cann drain all nfts and not pay fairly or pay amount close to zero for them.
When the function reaches the caller in the beneficiaries array:
It executes return which exits the entire function
This prevents all remaining beneficiaries from receiving their share
Most critically, it prevents the nft.burnEstate(_nftID) line from executing
Combined with another vuln- lack of check when appointing trustees here is what a malicous beneficiery can do:
A malicious beneficiary arranges to be added to the beneficiary list
They appoint a trusted friend or themselves as trustee (which is aseparate vuln)
The trustee manipulates NFT values as desired (which is a separate vuln)
The beneficiary calls buyOutEstateNFT
When the loop reaches their address in the array, the function returns
The NFT is never burned and remains in the contract
Remaining beneficiaries receive nothing. this depends on whetehr the benficiaries are pre pr post the position of the malicious beneficiery in the beneficieries array. however even those that "get disctribution" could get close to 0. here is how:
at step 3 above a malicious beneifciery, appointing herself (or a friend Trustee) as a Trustee they can now control the value of the nft and the asset to distribute. There are a few scenarios they can implement including setting too small/high value for an nft asset, say a house represented by an nft could be made worth just a fraction and even more could be set to be paid in a dummy or worthless asset that the malicous beneficiery has created and controls. This way the malicious beneficiery would distribute close to nothing to other beneficieries ofc if they happens to have been added before him in the array. Bassically the guy might not care since the tokens they will get might be worthless and just created by him.
Keep the NFT: Since the NFT isn't burned, it remains in the contract
Avoid Full Payment: Only beneficiaries listed before the attacker get paid
Manipulate Asset Value: Using trustee powers to set arbitrary values
Repeated Exploitation: The attacker could potentially try again later
This is a critical vulnerability as it:
Allows theft of valuable assets
Deprives other beneficiaries of their rightful compensation
Completely breaks the intended buyout mechanism
Could be easily exploited by any beneficiary
Important to note that some of assets money get trapped
manual review
The return statement should have been a continue to skip the current iteration but proceed with the rest of the function. Instead, it causes the entire function to exit prematurely, breaking the core functionality and creating a severe security vulnerability.
Also some check should be added for beneficieries to not be able to become Trusteees
implementation of some consensus for appointing Trustees.
the attacker pays with just minted magic money and this way does not even care that some of the funds get trapped in the contract due the earlier exit due return used instead of continue
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.