UseMigrationGasEstimate preserves an authority-bearing plan after manager revocation, restoring a revoked address during V1-to-V2 migration
The ENS Manager migration flow cached a ready migration plan keyed only on domain IDs, so when the registrant revoked the delegated V1 manager and a fresh V1 response showed the registrant as manager, the stale plan still granted the resolver role to the revoked address. The victim then signed a migration transaction that gave the revoked address real V2 resolver authority, letting it point the name at an attacker resolver and redirect payments, and the role survived later resolver repairs.
- Disclosed after under an hour
92156 w a medium usemigrationgasestimate preserves an authority bearing plan after manager revocation restoring a revoked address during v1 to v2 migration
Submitted on Sep 7th 2026 at 15:50:41 UTC by @go4ko for Audit Competition | ENS
- Report ID: #92156
- Report Type: Websites & Apps
- Report severity: Medium
- Target: https://github.com/immunefi-team/audit-comp-ens/tree/audit-comp-ready/apps/manager
- Impacts:
- Hijacking or bricking an ENS name during a Manager flow (registration, v1 to v2 migration, or transfer), such as: - a registration or migration that assigns the name, its ownership, registry, or resolver to an attacker - redirecting the recipient of a name transfer - leaving a name permanently inaccessible after the flow
Description
Brief/Intro
ENS Manager can finish constructing a migration plan while address A is the legitimate V1 Registry manager, keep that plan ready after the registrant revokes A, and later execute the unchanged pre-revocation calldata. Even after a completed fresh V1 response updates the real QueryClient cache to show the registrant V as the current manager, the plan-bearing migration-gas-estimate query still contains A because its identity includes selected domain IDs but omits manager-bearing domain state.
When V clicks the ordinary confirmation button, MigrationPage submits that retained plan to the production migration state machine. The victim-authorized HCA transaction grants the exact V2 ROLE_SET_RESOLVER role to revoked address A and no role to the correct live manager V. The wallet-confirmation UI only says “Restore the existing managers” and does not identify the grantee.
The end-to-end PoC then proves concrete consequences. A changes the migrated name to an attacker-controlled PermissionedResolver, Universal Resolver returns an attacker-selected EOA, and a separately generated payer sends exactly 0.01 ETH to that resolved address. V restores the legitimate resolver, but the repair does not remove A’s stale role. A therefore re-hijacks the resolver without another victim signature.
Security invariant and actors
For an eligible unwrapped .eth 2LD, registration ownership and V1 Registry manager authority are distinct:
- V — victim, BaseRegistrar token owner, migration signer, and live V1 manager after revocation;
- A — former V1 manager, valid when preview was built but revoked before confirmation;
- R — fresh attacker-controlled address returned after resolver hijacking;
- P — independently generated payer account, distinct from recipient R;
- HCA — V’s migration account, used by the production Manager flow.
The required authorization invariant is:
At the final migration authorization boundary, every V2 manager-role grantee
for an unwrapped name must equal the live V1 Registry owner of that name.
If the live V1 manager equals the registrant, no separate manager-role grant
must be emitted.
The vulnerable state transition is:
V1 subgraph domain.owner = A
-> Manager builds a fully ready A-bearing migration plan
-> V executes BaseRegistrar.reclaim(tokenId, V)
-> A loses V1 authority and still has no V2 authority
-> a completed fresh V1 response updates QueryClient to V
-> migration-gas-estimate retains the same query identity and A-bearing plan
-> V confirms the ordinary migration flow
-> victim-authorized HCA executes grantRoles(resource, 1 << 24, A)
-> A replaces the V2 resolver
-> Universal Resolver returns R and P pays R
-> V repairs the resolver, but A’s role remains
-> A replaces the resolver again without another signature from V
Vulnerability Details
1. Manager identity is derived from indexed V1 domain data
The in-scope V1 subgraph client requests both owner.id and registrant.id. For an unwrapped .eth name, the contextual classification helper interprets a different Registry owner as a separate manager:
const registryOwnerAddress = toAddress(domain.owner.id)
const managerAddress =
registryOwnerAddress &&
registryOwnerAddress.toLowerCase() !== registrant.id.toLowerCase()
? registryOwnerAddress
: null
Accordingly, a domain object fetched while A is manager becomes a classified name whose managerAddress is A. That is valid for previewing the then-current state. It becomes unsafe when the application later treats that old value as authority for a new on-chain role without checking the live Registry again.
2. The plan cache identity excludes manager-bearing state
useMigrationGasEstimate selects complete V1 domain objects but derives the query identity only from their IDs:
const domainIds = domains
.map((domain) => domain.id)
.sort()
.join(',')
const query = useQuery({
queryKey: [
'migration-gas-estimate',
ownerAddress?.toLowerCase() ?? '',
hcaAddress?.toLowerCase() ?? '',
domainIds,
selectionRevisionRef.current.revision,
],
queryFn: async () => {
const plan = await buildMigrationPlan({
domains,
hcaAddress,
migrationOwner: ownerAddress,
publicClient,
preflight,
})
return { estimate, plan }
},
})
Changing domain.owner.id from A to V does not alter the name ID, domainIds, or the selection revision. The cached result is security-sensitive because it contains the complete MigrationPlan and its encoded outer calls, not merely a display-only gas figure.
The primary PoC takes a full snapshot of the ready plan before revocation:
- TanStack query hash;
- dataUpdatedAt;
- HCA address;
- migration owner;
- classified manager address; and
- every encoded HCA outer call.
After V revokes A, the test triggers and awaits an active V1-only QueryClient refetch. The route counter advances only after the V-bearing response has been fulfilled. The test then establishes all of the following before confirmation:
current V1 cache manager == V
ready plan manager == A
ready plan after revocation deep-equals the complete pre-revocation snapshot
fresh response completion time <= confirmation start time
The preserved run received two completed post-revocation V-bearing responses. This rules out an explanation in which confirmation simply raced ahead of the fresh response.
3. buildMigrationPlan turns the retained object into executable authority
buildMigrationPlan classifies the supplied domains and passes the resulting managerAddress into atomic-batch construction. It does not independently read V1Registry.owner(namehash(name)).
The final negative controls call this frozen production function directly:
- With A as manager, the fresh plan contains one exact resolver-role grant to A.
- After an A-to-V change, a newly constructed plan normalizes managerAddress to null and emits no manager execution, no grantRoles call, and no manager-role verification expectation.
- After an A-to-B change, a newly constructed plan grants B exactly once and emits no grant or expectation for A.
These controls show that granting A is not required by migration semantics. It occurs only because Manager executes the retained pre-revocation plan instead of constructing or validating a current one.
4. MigrationPage submits the old plan without reconciling its grantee
MigrationPage receives the current v1Names array and exposes the gas-estimate result to the selection UI. Its handleBeginUpgrade only requires the result to have ready status before forwarding its plan:
if (gasEstimate.status !== 'ready') return false
uiActor.send({
type: 'migration.start',
plan: gasEstimate.plan,
signer,
hcaClient,
refreshAccount,
})
There is no comparison between gasEstimate.plan.classified[].managerAddress and either the freshly updated V1 query data or the live V1 Registry at this boundary. Consequently, the exact calldata produced before revocation remains eligible for victim authorization afterward.
5. The stale manager becomes an exact V2 role grant
buildRoleGrantCall converts managerAddress into:
grantRoles(resource, 1 << 24, managerAddress)
buildAtomicMigrationBatches inserts that call into the HCA batch and creates a verification expectation for the same address. Verification is therefore internally consistent with the stale plan: it proves that A received the role the plan requested, but never proves that A remains the legitimate V1 manager.
The E2E captures the expected HCA from the production plan before revocation. Its transaction scanner accepts only transactions:
transaction.from == V
transaction.to == plan-captured HCA
outer function == executeByOwner
It decodes the real mined calldata and requires:
exact resolver-role grants to A == 1
exact resolver-role grants to V == 0
role bitmap == 1 << 24
After migration, the complete role word stored for A must also equal exactly 1 << 24. This excludes an unrelated role, a bitmap superset, or an inferred transaction as explanations for the result.
6. Existing freshness checks validate different state
computeMigrationPreflight checks migration approvals, resolver readiness, profile data, direct routes, HCA readiness, and required code after classifying the supplied domains. It does not read the live V1 Registry manager.
assertMigrationApprovalPlanCurrent recomputes missing approvals and compares approval identifiers. An A-to-V manager transition can leave the relevant approval shape unchanged, while the security-sensitive role recipient has changed.
The retry-time source ownership guard checks BaseRegistrar ownerOf for an unwrapped name. V remains that token owner throughout this PoC, so the guard cannot detect a Registry-manager-only transition. Retry batch construction also reuses already classified names.
7. Confirmation does not identify the restored address
WalletConfirmationStepsDialog displays generic text:
Approve manager restoration
Restore the existing managers for your names.
The E2E opens this production dialog and confirms that neither A nor V is displayed. The hidden grantee is not the root cause—execution must reject stale authority regardless of presentation—but the UI gives the victim no usable warning that “existing manager” refers to an address they already revoked.
State transition demonstrated by the E2E
| Stage | BaseRegistrar owner | Live V1 manager | Current V1 cache | Ready plan | A’s V2 role | Security result |
|---|---|---|---|---|---|---|
| Initial legitimate delegation | V | A | A | Not ready | None | A is an authorized V1 manager. |
| Production preview ready | V | A | A | Grants A exactly 1 << 24 | None | Plan is correct only for this moment. |
| V revokes A in a later block | V | V | A initially | Still grants A | None | A cannot write either V1 or V2 resolver state. |
| Fresh V1 refetch completes | V | V | V | Unchanged A-bearing calldata | None | Browser security state is internally inconsistent before confirmation. |
| V confirms migration | V | V | V | A-bearing plan executes | Exactly 1 << 24 | Victim-signed HCA restores revoked A and grants V nothing separately. |
| First hijack and payment | V | V | V | Executed | Present | Universal Resolver returns R and P sends 0.01 ETH to R. |
| V repairs resolver | V | V | V | Executed | Present | Resolution is temporarily restored, but stale authorization survives. |
| A re-hijacks | V | V | V | No new plan | Present | A redirects resolution again without another victim signature. |
Attack sequence
- V owns an eligible unwrapped V1 .eth registration and has legitimately appointed A as its V1 Registry manager.
- V opens ENS Manager and proceeds to the migration selection page.
- Manager receives a V1 domain object whose owner.id is A and builds a complete ready migration plan.
- The plan contains exactly one ROLE_SET_RESOLVER grant to A and no separate grant to V.
- Before confirming that ready plan, V uses the ordinary BaseRegistrar reclaim operation to make V the live V1 Registry manager.
- The revocation is mined in a block later than the ready-plan snapshot.
- A now has no V1 authority, has no V2 resolver role, and cannot call either V1 or V2 setResolver.
- A fresh V-bearing V1 response completes and updates the real Manager QueryClient cache.
- Because only manager-bearing domain content changed, the migration-gas-estimate query identity remains unchanged and continues exposing the exact A-bearing plan and calldata.
- The production confirmation dialog describes generic manager restoration without disclosing A or V.
- V clicks the normal confirmation button and authorizes the production wallet requests.
- The application sends a victim-originated executeByOwner transaction to the HCA captured from the ready plan.
- The successful inner batch grants resource-specific role 1 << 24 to A, grants no corresponding role to V, completes the migration with V as V2 owner, and removes the HCA’s temporary broad approval.
- A uses the newly granted per-name role to install an attacker-controlled PermissionedResolver.
- Universal Resolver resolves the victim’s name to R.
- Fresh payer P transfers exactly 0.01 ETH to the resolved address, increasing R’s balance by that amount.
- V restores the legitimate resolver using owner authority.
- Because resolver repair does not revoke A’s role, A installs the attacker resolver again without any new action or signature from V.
Preconditions and practical likelihood
Internal preconditions
- V owns an eligible unwrapped V1 .eth 2LD.
- A is the legitimate V1 manager when the migration preview is created.
- The preview reaches ready state.
- V changes the V1 manager without changing the BaseRegistrar token owner or selected name ID.
- V confirms the still-mounted migration flow without leaving the page and rebuilding the plan.
External ordering condition
The plan must be created before the manager change and remain mounted until confirmation. This is a conditional state transition, not an unconditional takeover, and the report does not claim otherwise.
The sequence remains reachable through ordinary behavior: a registrant can prepare migration, revoke or normalize a delegated manager in another tab or wallet action, return to the ready preview, and continue. The PoC uses no timing race at the final click. It explicitly waits for the revocation receipt, awaits a fresh V1 refetch, proves the current cache contains V, and only then confirms the unchanged plan.
No ENS administrator, registrar controller, HCA owner other than V, project operator, wallet provider, or third-party service must act maliciously. A is not treated as trusted after revocation; exploiting authority that the system unexpectedly regrants to a former delegate is the attacker model, not a malicious privileged-role assumption.
Why existing controls do not stop the issue
| Existing control | What it establishes | Why the stale grant remains possible |
|---|---|---|
| BaseRegistrar ownerOf check | V still owns the registration token | It does not identify the live V1 Registry manager. |
| Migration preflight | Infrastructure, approvals, routes, profiles, resolvers, and HCA state are usable | It classifies the supplied domain object and never re-reads V1 Registry manager authority. |
| Approval-plan freshness | Planned and currently missing approvals have the same identifiers | The manager grantee is not part of this comparison. |
| Ready gas estimate | The retained plan simulated successfully | Successful simulation does not establish that its role recipient is still authorized. |
| Manager-role verification | The planned address received the planned role | It verifies the unsafe request rather than the legitimacy of its recipient. |
| Temporary HCA approval cleanup | HCA’s broad operator approval was removed | A’s per-resource ROLE_SET_RESOLVER is independent and remains active. |
| V2 ownership | V becomes and remains the migrated name owner | Resolver roles can authorize A while V still appears as owner. |
| Resolver repair | V can point the name back to the legitimate resolver | Repair does not revoke A, so A can immediately replace it again. |
| Confirmation copy | V is told that managers will be restored | The address, affected name-to-grantee mapping, and exact role are not shown. |
Known-issue distinction
This finding is not the same root cause as any disclosed competition issue:
| Disclosed or related issue | Distinction |
|---|---|
| SEC-TXM-002 — configured/cached smart-account address is not cross-checked | SEC-TXM-002 concerns accepting an HCA address without comparing it to SDK derivation. Here the production HCA is captured from the plan and the mined transaction is required to target that same HCA. The wrong value is the role grantee retained inside Manager’s migration plan. |
| ensdomains/contracts-v2 issue #418 — delegated roles survive V2 ownership transfer | Issue #418 concerns an already-existing role surviving an ERC-1155 ownership transfer. This PoC performs no V2 ownership transfer and proves A’s V2 role is zero before migration. Manager’s victim-signed migration transaction creates a new role for A only after V revoked A in V1. |
| QA-01 and transfer-role follow-ups | Those disclosures concern post-transfer failures or role combinations. This path is an unwrapped V1-to-V2 migration and demonstrates a newly created unauthorized role, resolver hijacking, recipient redirection, and post-repair re-hijacking. |
| WEB-806 — migrated subname records are not visible | WEB-806 is a display/record-visibility issue for migrated subnames. This finding affects an unwrapped .eth 2LD and produces real on-chain resolver authority for a revoked address. |
The V2 Registry and PermissionedResolver enforce the roles they are given. The vulnerability lies in the in-scope Manager application asking V to grant the correct role to an address whose underlying V1 authority no longer exists.
Impact Details
The appropriate competition impact is:
Critical — Hijacking an ENS name during a Manager V1-to-V2 migration by assigning its resolver authority to an attacker.
The demonstrated facts map directly to that impact:
- V completes the normal Manager migration and remains the apparent V2 owner.
- The application-generated, victim-authorized HCA transaction grants A a real resource-specific resolver role.
- A was already revoked and could not modify the V1 or V2 resolver before that transaction.
- A installs a genuine attacker-controlled PermissionedResolver afterward.
- The production-compatible Universal Resolver path returns attacker-selected address R.
- A distinct payer transfers exactly 0.01 ETH to the resolved recipient.
- V’s ordinary resolver repair does not remove A’s authority.
- A re-hijacks the name without another victim signature.
ENS resolution is commonly relied upon for payment addressing, identity, content, and application routing. While the malicious resolver is installed, any wallet or integration resolving the name can be directed to attacker-selected records. The preserved payment demonstrates the full recipient-redirection mechanism instead of assuming that a changed resolver is automatically impactful.
The report does not claim that A permanently owns the name, that recovery is impossible, or that the local-fork ETH represents production loss. V remains owner and can revoke A’s role once the hidden authorization is discovered. The scoped impact explicitly includes hijacking, attacker resolver assignment, and recipient redirection; irreversible ownership loss is not required.
Risk Breakdown
| Gate | Verdict | Evidence |
|---|---|---|
| Can Manager execute the stale plan? | YES | The complete ready-plan snapshot remains equal after revocation and fresh V1 refetch, then succeeds through the production UI. |
| Is the wrong grantee bound to the victim’s transaction? | YES | The decoder accepts one victim-originated executeByOwner call to the plan-captured HCA and finds exactly one grant to A and zero to V. |
| Is A unauthorized before migration? | YES | Live V1 manager is V, A’s V2 role is zero, and A’s V1/V2 resolver-write simulations revert. |
| Does the transaction create persistent authority? | YES | A’s post-migration role word equals exactly 1 << 24 and survives V’s resolver repair. |
| Is there a concrete third-party consequence? | YES | Universal Resolver returns R and independently generated payer P transfers exactly 0.01 ETH to R. |
| Does the path require a malicious protocol role? | NO | Privileged impersonation is confined to creation of a local-fork fixture; the exploit uses ordinary V and formerly delegated A behavior. |
Severity is Critical under impact 6286. Likelihood is conditional on the reachable ready-preview-then-manager-change sequence and should be assessed separately from the demonstrated impact.
Recommended Remediation
Manager identity must be handled as live authorization state rather than immutable indexed input.
Required fix
For every unwrapped name, enforce the following immediately before the final user authorization and whenever a transaction batch is rebuilt:
planned manager == V1Registry.owner(namehash(name))
If the live manager differs from the previewed value:
- invalidate the existing MigrationPlan;
- return the user to review or construct a new plan;
- require fresh confirmation for the changed calldata; and
- omit a separate manager-role grant when the live manager equals the registrant.
Where the migration architecture permits it, place the authority assertion in the same atomic execution path as the V2 grant to remove the read-to-submit gap. A browser-only freshness read materially improves this path but cannot provide the same race resistance as an on-chain assertion.
Defense in depth
- Include a canonical fingerprint of security-bearing domain fields in the migration-gas-estimate key: at minimum domain ID, owner.id, registrant.id, and relevant wrapped-owner data.
- Add an assertMigrationManagerPlanCurrent guard adjacent to the existing approval-plan freshness guard.
- Re-read live V1 manager state before every retry or rebuilt batch instead of reusing plan.classified.
- Treat a V1 response that changes only manager data as an explicit plan invalidation event.
- Display each selected name, planned manager address, target registry, and role bitmap in the wallet-confirmation details.
- Add regression tests covering A-to-V and A-to-B transitions after preview readiness, including a completed fresh V1 response under an unchanged selected-name ID.
- Preserve the negative controls included with this report: a fresh A-to-V plan must have no separate grant, while a fresh A-to-B plan must grant B and never A.
Changing only the wording of the confirmation dialog is insufficient. Changing only the cache key also leaves open other stale or adversarial data paths. The final authorization boundary must validate the grantee.
References
- useMigrationGasEstimate query identity and plan result
- V1 names QueryClient source
- MigrationPage consumes current V1 names and gas estimate
- [MigrationPage submits gasEstimate.plan](https://github.com/immunefi-team/audit-comp-ens/blob/cda79acaad59711b943fc68207ebb3f1d0ff8596/apps/manager/src/features/migration/pages/MigrationPage.tsx#L259-L
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
Likely the migration gas-estimate query key omits manager-bearing domain state, so a cached plan built before the manager change is reused and submitted without re-checking the live V1 Registry manager.
Impact
A revoked manager could gain real resolver authority over the migrated name, redirect resolution to an attacker address and receive payments, and re-hijack the resolver after the owner repairs it, though the report notes this is a conditional state transition requiring the plan to stay mounted until confirmation.
What the attacker needed
Victim owns an unwrapped .eth name; a manager was delegated then revoked; plan built before revocation, page stays open; victim confirms the migration
The fix
The migration plan should be rebuilt or validated against the live V1 Registry manager at the confirmation boundary, and the query identity should include manager-bearing state.
How it was found
- The registrant appoints a manager for an unwrapped .eth name and opens the migration selection page.
- The Manager builds a ready migration plan containing a resolver-role grant to that manager.
- Before confirming, the registrant reclaims the name so the registrant becomes the live V1 manager.
- A fresh V1 response updates the cache to show the registrant as manager, but the cached plan is unchanged.
- The registrant clicks the normal confirmation button and signs the migration transaction.
- The transaction grants the resolver role to the revoked address and none to the registrant.
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 name owner can let someone else manage their name. Here the owner took that permission away, and the website's migration screen kept an old prepared instruction that still gave the removed person control. When the owner clicked the normal confirm button, they unknowingly handed that control back, so the removed person could redirect where the name points.
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.