The MembershipFactory::createNewDAOMembership
function in the MembershipFactory
contract contains an external call to deploy a TransparentUpgradeableProxy
before critical state variables are updated. This sequence allows for potential reentrancy attacks, where an attacker could re-enter the function and attempt to manipulate the contract state before it is fully updated.
The reentrancy vulnerability arises due to the deployment of the TransparentUpgradeableProxy
via an external call, which occurs before state variables such as getENSAddress
and userCreatedDAOs
are updated with the final proxy
address. During this external call, there is a risk that a malicious contract could re-enter createNewDAOMembership
and attempt to exploit the partially updated state.
The external call occurs at:
Following this call, critical state variables such as dao.ensname, dao.daoType, and dao.currency are modified, presenting a reentrancy risk.
If exploited, this vulnerability could allow attackers to interfere with the proper functioning of the contract, potentially manipulating or corrupting state variables associated with the DAO membership creation. This could result in unauthorized DAO creations, inconsistent state data, or other unexpected behaviors.
Static Analysis: slither
Manual Analysis
Add this code to test/MembershipFactory.test.ts
Test results:
Update State Variables Before External Calls: Ensure that critical state variables are modified before making any external calls. Temporarily assign a placeholder address (example address(0x1))
to getENSAddress
and userCreatedDAOs
mappings to mitigate reentrancy risk.
Final State Update After Call: Perform the actual update of state variables to the correct values after the external call completes successfully.
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.