Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: medium
Invalid

Potential for Unauthorized Token Minting in joinDAO Function

https://github.com/Cyfrin/2024-11-one-world/blob/main/contracts/dao/MembershipFactory.sol#L140

Summary- The joinDAO function lacks adequate protection against unauthorized token minting, allowing users to potentially bypass restrictions and mint additional DAO tokens, which could compromise the DAO’s membership structure and security.

Vulnerability Details- The joinDAO function is vulnerable to manipulation, as it lacks protections against repeated calls

Impact - By repeatedly calling joinDAO, an attacker could mint multiple tokens within a tier, potentially bypassing the maxMembers limit and tier restrictions. For instance, if the attacker identifies an unchecked loop or limited validation of tierIndex, they can continuously call the function to accumulate unauthorized tokens.

Tools Used- manual review

Recommendations-

function joinDAO(address daoMembershipAddress, uint256 tierIndex) external nonReentrant {
require(!hasJoined[msg.sender][daoMembershipAddress], "Already joined this DAO"); // Prevent repeated calls
DAOConfig storage dao = daos[daoMembershipAddress];
require(dao.noOfTiers > tierIndex, "Invalid tier");
TierConfig storage tier = dao.tiers[tierIndex];
require(tier.amount > tier.minted, "Tier full");
uint256 tierPrice = tier.price;
uint256 platformFees = (20 * tierPrice) / 100;
tier.minted += 1; // Update mint count
hasJoined[msg.sender][daoMembershipAddress] = true; // Mark as joined
// Safe token transfers
SafeERC20.safeTransferFrom(IERC20(dao.currency), _msgSender(), owpWallet, platformFees);
SafeERC20.safeTransferFrom(IERC20(dao.currency), _msgSender(), daoMembershipAddress, tierPrice - platformFees);
IMembershipERC1155(daoMembershipAddress).mint(_msgSender(), tierIndex, 1);
emit UserJoinedDAO(_msgSender(), daoMembershipAddress, tierIndex);
}
}
Updates

Lead Judging Commences

0xbrivan2 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
0xbrivan2 Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!