The MembershipERC1155 contract contains a vulnerability within the sendProfit function that allows for inaccurate profit distribution among token holders due to improper handling of the weighted share calculation. The use of totalSupply without appropriate checks on token weighting can result in users receiving profits that do not accurately represent their holdings, leading to an unfair profit distribution.
The sendProfit function calculates profit shares based on totalSupply but does not accurately account for the unique weighting of each token ID. Since each token ID has a different weight, profits calculated solely on totalSupply may not align with the actual weighted value of token holdings across all users. This mismatch can result in over- or under-allocation of profits to token holders, compromising fair distribution.
The following test demonstrates the vulnerability by comparing the expected profit distribution using the token weights against the flawed distribution produced by the sendProfit function. In this example, a user holding a heavily weighted token (e.g., ID 0 with weight 64) should receive a larger share of the profit, but the current code does not account for this.
This flaw results in profit misallocation across token holders, causing discrepancies in the intended distribution based on the weight of each token ID.
Affected users may lose trust in the system if they realize their profits are not proportional to their holdings.
Malicious users may exploit this vulnerability by transferring low-weight tokens to maximize their profit share at the expense of legitimate holders.
Manual review.
Modify the sendProfit function to calculate each user’s profit share based on shareOf(account) instead of relying solely on totalSupply. This function already accounts for each token's weight in the distribution.
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.