The current implementation of MembershipFactory::joinDAO fails to account for USDC's and WBTC's centralized security features including blacklisting and pause mechanisms. Users could face unexpected transaction failures and lost gas fees if their addresses are blacklisted or if the tokens are paused by their administrators.
The contract doesn't handle scenarios where transfers might fail due to administrative actions like blacklisting or pausing. This could lead to users being unable to join DAOs, stuck transactions, and potential loss of gas fees if transactions revert due to these security features being activated.
The issue lies in the assumption that token transfers will only fail due to insufficient balance or allowance. The implementation doesn't account for external administrative controls that could affect token transfers even when balance and allowance checks pass. Additionally, there's no mechanism to handle or notify users about failures due to these token-specific restrictions.
https://github.com/Cyfrin/2024-11-one-world/blob/main/contracts/dao/MembershipFactory.sol#L140
Implement proper error handling and state checks for these specific tokens:
This improved implementation:
Uses SafeERC20 for safe interactions with all ERC20 tokens
Adds pre-transfer balance and allowance checks
Verifies actual balance changes after transfers
Follows CEI pattern (Checks-Effects-Interactions)
Includes emergency withdrawal functionality for stuck funds
Provides clearer error messages for transfer failures
Maintains proper balance accounting even with token-specific restrictions
These changes make the contract more robust when dealing with USDC, WETH, WBTC, and similar tokens that might have additional transfer restrictions or security features.
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.