BuilderWallet init() is unprotected/re-initializable, enabling takeover and theft of builder fees
The BuilderWallet contract's init() function had no access control or one-time guard, so anyone could overwrite the stored builderAdmin address. An attacker could then call sweep() as the new admin and drain all ERC20 tokens held by any builder wallet.
Submitted by darf_tech, also found by 0x04, 0xAura, 0xMirce, 0xnbvc, 0xzys, agent001, Agontuk, Agrawain, alaskanking, AlexNiht, allan31, AnantaDeva, arturtoros, AuditorPraise, axelot, BlueSheep, cheng9061, ciphermalware, critfinds, Diavolo, dtang, edoscoba, ElmInNyc99, eternal1328, forlz, Funen, Gakarot, gegul, gwumex, happykilling, ht111111, humanitia, I1iveF0rTh1Sh1t, Icarus, Ituba, jerry0422, johnyfwesh, joicygiore, K42, Kaysoft, kimnoic, lamassu, lazlosoot, legat, LimeiBBQ, LoopGhost007, lufP, Manvita, mehdi81, Merkleboy, merlin_san, mibunna, mohamedfahmy, niffylord, one, piki, qed, Race, Rifter, rox_k, s4id, SarveshLimaye, Spektor, tkmk, Trynax, Tupaia, Valves, Vemus, VulSight, Web3Angel, wilson9x1, wuji, Xylem, zcai, and zzebra83
In BuilderWallet, the admin is stored in builderAdmin but init() has no access control and no “only-once” guard:
BuilderWalletdefinition:RiskEngine.sol#L2307init()(unrestricted, overwritesbuilderAdmin):RiskEngine.solL2315sweep()(only gated bybuilderAdmin):RiskEngine.solL2319
Builder wallets are deployed by BuilderFactory.deployBuilder(...), which calls BuilderWallet(wallet).init(builderAdmin) after CREATE2 deployment: RiskEngine.sol L2371
Because init() remains callable after deployment, any attacker can overwrite builderAdmin and then legitimately pass the sweep() authorization check.
Exploit Steps
- Builder wallet is deployed via
deployBuilder(...):RiskEngine.solL2371 - Builder wallet accumulates ERC20 balances (fees/tokens).
- Attacker calls
BuilderWallet.init(attacker)to overwritebuilderAdmin:RiskEngine.solL2315 - Attacker calls
BuilderWallet.sweep(token, attacker)to drain balances:RiskEngine.solL2319
Impact
Direct theft of all ERC20 balances held by any builder wallet (including protocol-distributed fees/shares).
Proof of Concept (minimal, runnable Foundry test)
View detailed Proof of Concept
Protect
builderWallet.init.
Status: Mitigation confirmed. Full details in reports from Valves, edoscoba, and Nyx.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The init() function lacked an access-control check and a guard preventing it from being called more than once, so it could be re-invoked to overwrite the admin address.
Impact
An attacker could steal all ERC20 balances held by any builder wallet, including protocol-distributed fees and shares.
What the attacker needed
A deployed builder wallet holding tokens; no special access needed
The fix
The project mitigated the issue by protecting builderWallet.init, and the mitigation was confirmed.
How it was found
- A builder wallet is deployed through deployBuilder, which calls init with the intended admin.
- The wallet accumulates ERC20 token balances such as fees.
- The attacker calls init with their own address, overwriting builderAdmin.
- The attacker calls sweep to transfer the tokens to themselves.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract is a program on a blockchain that holds funds. This wallet contract had a setup function that was supposed to run once, but it could be called again by anyone. That let an attacker make themselves the wallet's admin and then use the admin-only withdrawal function to take the tokens.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.