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

Incorrect Transfer Logic in buyOutEstateNFT Function

Description : Incorrect Transfer Logic: The function incorrectly transfers the finalAmount / divisor to all beneficiaries, including the buyer, when it should only transfer to the non-buying beneficiaries.

Impact: The function fails to properly distribute the finalAmount among the beneficiaries.

Proof of Concepts-

Recommended mitigation `function buyOutEstateNFT(uint256 _nftID) external onlyBeneficiaryWithIsInherited { uint256 value = nftValue[_nftID]; uint256 divisor = beneficiaries.length; uint256 multiplier = beneficiaries.length - 1; uint256 finalAmount = (value / divisor) * multiplier;

IERC20(assetToPay).safeTransferFrom(msg.sender, address(this), finalAmount);
for (uint256 i = 0; i < beneficiaries.length; i++) {
if (msg.sender == beneficiaries[i]) {
continue; // Skip the buyer from receiving funds
} else {
IERC20(assetToPay).safeTransfer(beneficiaries[i], finalAmount / multiplier); // Corrected division
}
}
nft.burnEstate(_nftID);
Updates

Lead Judging Commences

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

buyOutNFT has wrong denominator

buyOutNFT has return instead of continue

Support

FAQs

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