As Cyfrin Audit Report 7.2.1 shows
MembershipERC1155::sendProfit can be front-run by calls to MembershipFactory::joinDAO to steal profit from existing DAO members.
One world emphasizes that the attacker would pay the cost more than the profit.
One World Project: Membership must be purchased, and if a user wishes to acquire a significant number of shares to potentially front-run the sendProfit function, they would need to spend a much larger amount than the profit they would gain.
But under the current function sendProfit(uint256 amount
, the default caller would be the daoCreater, which may include one world. Don't check the profit amount, which creates the potential scenarios for attackers to gain more profit than their cost.
Below is one scenario in which the attacker can get more profit than their cost.
One daoCreater creates one DaoMemberShip, DaoConfig, and TierConfig as below
Before the daoCreater sends profit, five users also join the dao.
user1 joinDao by purchasing tieIndex(tokenId) = 0, paid 300 wei(eth), user2,user3,user4,user5 as user1
For now, the daoCreater wants to send profit to award the five members. for example, 4000wei. During this situation, the front-run attacker can mint five tokedId=0, paying 1500 wei, but can get 2000 wei, profiting 500 wei.
POC as below
attacker pays 1500 wei, gets 2000 wei profit, and finally, a net profit of 500 wei.
To make the test work, I have modified the hardhat environment, can add below to this URL: https://github.com/sodexx7/One_world_temp_202411/blob/193b4dfad76ecc157eff72cf35ed2caf8cd00fa3/test/MembershipFactoryPOC.test.ts#L66
As Cyfrin Audit shows, front-running the sendProfit can allow the attacker to gain more shares than the previous users. Which leads to some unfairness for the previous users.
Attackers can profit just by front-running the sendProfit; their goal is not to become members. On the other hand, this has bad effects on normal users who become members.
There are no specific specifications about how much profit would be sent for now; there are no other functions or mechanisms to help daoCreater deal with this situation. Improve the difficulties for daoCreater in motivating their members.
Hardhat, Manual
Apply Cyfrin Audit suggestion
Consider implementing a membership delay, after which profit sharing is activated.
Limiting the sendProfit amount to make the front-run can't work, but it will cause some trouble for daoCreators.
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.