Skip to content
Access control Audit finding Advanced

A former owner will redirect a transferred ENS name to an attacker-controlled address for the new owner by retaining PermissionedResolver write authority.

When an ENS V2 name with a dedicated PermissionedResolver is transferred without detaching the resolver, the seller keeps the resolver write roles while the buyer becomes the token owner. The Portal's record-edit check trusts those stale resolver roles, so the former owner can still change the name's ETH address to an attacker-controlled one, and the Portal then resolves and renders that wrong address to users.

n3310y Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

90981 w a medium a former owner will redirect a transferred ens name to an attacker controlled address for the new owner by retaining permissionedresolver write authority

Submitted on Aug 28th 2026 at 16:07:44 UTC by @n3310y for Audit Competition | ENS

  • Report ID: #90981
  • Report Type: Websites & Apps
  • Report severity: Medium
  • 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

Brief/Intro

When an ENS V2 name keeps a dedicated PermissionedResolver during transfer, the Portal transfers the ERC-1155 name token but does not revoke the seller's resolver write roles. The Portal's record-edit authorization then accepts the former owner because it checks resolver roles instead of current token ownership. A former owner can therefore use the normal Portal editor after the name is owned by someone else, change addr(60) to an attacker-controlled address, and cause the Portal to resolve and render the buyer's ENS name to that wrong recipient.

The primary impact leg then uses the Portal's own native Transfer name flow: a separate victim enters the poisoned ENS name, the Portal displays the attacker address, and the Portal submits the name transfer to that resolved address. Direct on-chain reads prove the victim-owned name's ownerOf(tokenId) changed to the attacker.

The separate 0.01 ETH payment is retained only as secondary local-fork balance evidence because the Portal has no native ETH-send route.

Vulnerability Details

ENS V2 separates the name token's ownership from the write permissions in a dedicated resolver. The token owner is read from the leaf PermissionedRegistry.ownerOf(tokenId), while ROLE_SET_ADDR and ROLE_SET_TEXT are stored in the resolver. Moving the token does not inherently move those resolver roles.

This report concerns the Portal's handling of those two state domains; it does not submit a claim against the underlying ENS contracts, which are outside the supplied scope.

The Portal transfer route checks the connected wallet's ability to transfer the name and then renders SendNameForm. useTransferDetachTargets.ts:83-95 makes the resolver option visible when the current seller has the registry role. It does not make resolver detachment mandatory and does not add a fallback role-revocation call when the option is turned off.

With a pre-existing ETH record and detachResolver=false, the real Portal plan is exactly:

set-eth-addr -> transfer-token

set-eth-addr reaches setEthAddress.ts:23-55, which calls getResolver(), creates createSetForwardResolutionRequest() for coin type 60, and submits setForwardResolution().

transfer-token reaches the real transferToken() helper and submits the leaf-registry safeTransferFrom() call. Both steps succeed in the recorded run, and the on-chain owner changes to the buyer while the resolver address and former-owner roles remain unchanged.

After the transfer, the negative control is important. The buyer is the verified ownerOf(tokenId) but has no resolver write role, so the real Portal edit route displays Permission Denied. The former owner is not the token owner, but useCanEditRecords() sees the former owner's resolver role and allows the edit route. This proves that the observed authorization is role-based and stale, rather than a public-resolver or UI-only bypass.

Once the former owner edits the ETH row, saveRecords.ts:152-171 waits for a mined success. The E2E test independently reads ownerOf(tokenId), getResolver(label), addr(node, 60), text(node, 'description'), and both owners' resolver role bits. It then visits the real /$name/address route and asserts that the attacker-controlled address is rendered.

The primary impact proof continues through the Portal's native transfer implementation. SendNameForm.tsx:81-109 passes the recipient field through useAddressResolution() and calls startTransfer({ recipient, options }) only after the name has resolved. useAddressResolution.ts:38-63 uses the shared resolved-address query, which calls resolveAddressOrName() through getResolvedAddress.ts:18-31.

In the E2E run, user4 enters the poisoned ENS name in this exact field, the displayed recipient is the attacker, and useTransferName.ts:124-145 then executes the native detachNameResolver() and transferToken() steps. The receipt-backed ownerOf(victimTokenId) transition is therefore produced by the Portal's own state-changing flow; the separate ETH payment is not required to create or validate that primary loss.

The Manager also creates this class of resolver state in a real product flow. buildAtomicMigrationBatches.ts:396-405 initializes a PermissionedResolver with ROLES_ALL, and buildAtomicMigrationBatches.ts:422-431 separately authorizes wallet roles. The E2E fixture uses a dedicated resolver with the same role model; it does not mock or patch the Portal authorization code.

Root Cause

The root cause is a lifecycle mismatch between ENS V2 name ownership and the separate role state held by a dedicated PermissionedResolver.

In useCanEditRecords.ts:38-41, the source documents the stale-role condition: a permissioned resolver is authorized by ROLE_SET_*, and after a transfer that keeps the resolver the previous owner typically retains those roles while the new token owner does not.

The authorization branch at useCanEditRecords.ts:106-116 implements that condition:

TS
const hasResolverRole = roleQueries.some((query) => query.data === true)

const canEdit = (() => {
  if (!enabled || !connectedAddress || isLoading || !resolverAddress) {
    return false
  }

  if (isPermissioned) return hasResolverRole // @audit current token ownership is not required

  // Public / non-permissioned resolvers: token owner can edit.
  return isOwner
})()

isOwner is queried and returned, but it is used only for non-permissioned/V1-style resolvers. For a permissioned resolver, possession of a resolver role is sufficient. The code does not require isOwner or otherwise revoke the former owner's resolver role when the ERC-1155 name token moves.

The transfer UI makes the vulnerable state reachable. SendNameForm.tsx:68-95 initializes detachResolver as an optional choice. Its warning at SendNameForm.tsx:46-51 tells the seller that records keep resolving, but does not disclose that resolver-role holders keep write authority.

At buildTransferPlan.ts:27-40, disabling resolver detachment produces a plan that updates the ETH address and then transfers the name token, with no resolver-detach or role-revocation step:

TS
if (options.setEthAddress && !options.detachResolver) {
  steps.push('set-eth-addr')
}

if (options.detachResolver) {
  steps.push('detach-resolver') // @audit omitted when the seller keeps the resolver attached
}

steps.push('transfer-token')

That plan is executed by useTransferName.ts:124-145, which invokes the production setEthAddress() and transferToken() helpers. The token step at transferToken.ts:63-94 submits the ERC-1155 safeTransferFrom() call to the leaf registry:

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

transactionManager.startTransaction(
  {
    type: 'custom',
    request: {
      type: 'eoa',
      from: walletWithAccount.account.address,
      to: registryAddress,
      data,
      value: 0n,
      chainId,
    },
  },
  signer,
  { id, description: `Transfer ${name}`, publicClient, chainId },
)

Nothing in that branch revokes the former owner's roles in the still-attached resolver. The subsequent record write is built by saveRecords.ts:125-170: setRecordsWriteParameters() creates the resolver write, encodeFunctionData() encodes it, toEoaCustomIntent() binds it to the connected wallet address, and transactionManager.startTransaction() submits it and waits for the receipt.

Attack Path

{% stepper %} {% step %}

Set up a dedicated PermissionedResolver

The setup registers a fresh ENS V2 .eth name on the isolated local Sepolia fork and deploys a dedicated PermissionedResolver proxy through the repository's real VerifiableFactory.deployProxy() path. The resolver is initialized for the seller with ROLES_ALL, creating the same role-based authorization model used by the product. {% endstep %}

{% step %}

Set a baseline ETH address

The seller connects to the real Portal with the repository's headless wallet fixture. The seller opens /$name/edit-records, adds the future buyer as the ETH addr(60) record, clicks Save, and completes the real saveRecords() transaction through transactionManager. {% endstep %}

{% step %}

Transfer while retaining the resolver

The seller opens /$name/ownership/transfer, enters the buyer address, and turns Detach the resolver off. The UI warning confirms that records remain resolving, but it does not say that existing resolver writers retain mutation authority. {% endstep %}

{% step %}

Execute the real transfer plan

The seller signs the real two-step transfer plan. setEthAddress() submits the recipient ETH record update, then transferToken() submits safeTransferFrom(seller, buyer, tokenId, 1, '0x') to the V2 leaf registry. There is no resolver-role revocation in this branch. {% endstep %}

{% step %}

Confirm stale resolver roles

The E2E test reads the chain. ownerOf(tokenId) is now the buyer, the resolver remains attached, the former seller still has root ROLE_SET_ADDR and ROLE_SET_TEXT, and the buyer has neither role. {% endstep %}

{% step %}

Verify the current owner is denied

The buyer is used as a negative control. The real Portal edit route displays Permission Denied, confirming that current token ownership alone does not grant edit access for this permissioned resolver. {% endstep %}

{% step %}

Reconnect as the former owner

The seller reconnects and opens the same edit route. useCanEditRecords() returns canEdit=true solely because the seller's resolver roles remain true, despite isOwner=false. {% endstep %}

{% step %}

Poison the ETH record

The seller changes the ETH row to 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC and clicks Save. The Portal calls setRecordsWriteParameters(), encodes the resolver write, submits an EOA intent to the resolver proxy, and waits for the mined success receipt. {% endstep %}

{% step %}

Confirm poisoned resolution

The test reads the final state and visits /$name/address. The name remains owned by the buyer, but addr(node, 60) and the Portal's rendered resolution now point to the attacker's address. {% endstep %}

{% step %}

Resolve the poisoned name in the native transfer flow

A separate name is independently owned by user4. In the real Portal /$victimName/ownership/transfer route, user4 enters the poisoned name as the recipient. The same Portal useAddressResolution() path displays the attacker's address, not the buyer address established in the baseline. {% endstep %}

{% step %}

Transfer the victim-owned name to the resolved attacker address

user4 clicks Transfer name and completes the Portal's native transaction manager. The Portal submits detachNameResolver() followed by transferToken()/ERC-1155 safeTransferFrom(user4, attacker, victimTokenId, 1, '0x'). Direct chain reads prove ownerOf(victimTokenId) changes from user4 to the attacker. {% endstep %}

{% step %}

Perform secondary settlement evidence

As secondary settlement evidence, the test takes the exact address rendered by the Portal and a fourth ordinary local wallet sends 0.01 ETH to it. The receipt succeeds, the attacker recipient balance increases by exactly 0.01 ETH, and the victim balance decreases by exactly 0.01 ETH plus the measured gas fee. This payment is not needed to establish the primary Portal-transfer impact. {% endstep %} {% endstepper %}

Impact Details

The direct demonstrated impact is persistent wrong-address resolution in the in-scope Portal. The buyer owns the ENS V2 name, but the former owner can change its payment-facing addr(60) record to an attacker-controlled address. The Portal's address-resolution page renders that attacker address for the buyer's name.

This directly matches the supplied Critical impact for causing the application to resolve or render an ENS name to an attacker-controlled address (scope.md, Critical impact #371). The severity classification does not depend on the separate Manager-flow wording in #372; #371 alone exactly covers this Explorer/Portal outcome.

The strengthened E2E run first executes a loss-producing Portal transaction, not a wallet-only payment: user4 enters the poisoned ENS name in the Portal's native transfer form, the Portal resolves it to the attacker, and ownerOf(tokenId) for a separate victim-owned name changes from user4 to the attacker. It then follows the same attacker address rendered by Portal and performs a separately measured 0.01 ETH local payment.

Both receipts and all relevant state/balance deltas are asserted. These are isolated local-fork demonstrations of the scope #371 wrong-recipient consequence, not claims that live production funds or names were lost during testing.

The exact observed values in the passing run are:

Quantity Observed value
Former owner's unauthorized record-write gas 47,430,015,746,760 wei (0.00004743001574676 ETH)
Seller-side baseline + transfer + attack gas in the recorded run 234,517,582,202,268 wei (0.000234517582202268 ETH)
Buyer-owned name after attack ownerOf(tokenId) = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
ETH address before attack 0x70997970c51812dc3a010c7d01b50e0d17dc79c8
ETH address after attack 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc
Native Portal impact target name audit-stale-resolver-victim-1787930630.eth
Native Portal impact target token ID 111691872372097001870290707158648147930855833852031452623577822318151830863872
Native Portal impact owner before → after 0x90F79bf6EB2c4f870365E785982E1f101E93b906 → 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC
Native Portal impact transactions 0x3d60a09c3eed15c8a604fe2fc9f9276931e34d8b2750847659728422b2141384 (detach resolver), then 0x1e6f86e072f2dcdde79a3bf6bd773fa33c8128978aa90321a8b9eacd231b6995 (transfer token)
Native Portal impact gas 118,108,428,315,432 wei (0.000118108428315432 ETH)
Local victim account user4 = 0x90F79bf6EB2c4f870365E785982E1f101E93b906
Downstream payment value 10,000,000,000,000,000 wei (0.01 ETH)
Downstream payment receipt 0x1bb9ed3cd62a0536dd2959c134f3fb273e4cb08087fa7e20a99a48bf602193b6, block 11585712, success
Victim balance before → after 9,999.998001125376627809 ETH → 9,999.987980124719327809 ETH
Attacker recipient balance before → after 10,000 ETH → 10,000.01 ETH
Victim value loss 10,000,000,000,000,000 wei (0.01 ETH)
Victim gas fee 21,000,657,300,000 wei (0.0000210006573 ETH)
Victim total balance loss 10,021,000,657,300,000 wei (0.0100210006573 ETH)
Attacker recipient increase 10,000,000,000,000,000 wei (0.01 ETH)

The security loss is control and integrity of the buyer's resolution: the buyer cannot repair the record through the same Portal because the buyer is denied by the role check.

The primary E2E impact is also a native Portal transaction: user4 enters the poisoned name as a recipient, the Portal resolves it to the attacker, and the victim-owned audit-stale-resolver-victim-1787930630.eth changes owner from user4 to the attacker in the mined ERC-1155 transfer.

The separate local ETH settlement then reads the same Portal-rendered address and sends 0.01 ETH to it. The ETH victim's exact balance loss is the payment value plus the measured 21,000,657,300,000 wei gas fee; the attacker-controlled recipient receives the full payment value.

The local amounts and generated name are reproducible proof quantities, not assertions that these exact values were lost on production or that they limit the amount a later production user could send.

Risk Breakdown

This is a deterministic authenticated attack by a normal former name owner, not a privileged administrator and not a race.

The attacker needs only a name with a dedicated PermissionedResolver and the ability to complete a normal transfer while choosing the existing Portal option to keep the resolver attached. No buyer private key, buyer session, XSS, compromised RPC, wallet mismatch, HCA session, contract upgrade, or third-party service compromise is needed.

The attacker performs one ordinary post-transfer record edit from the same wallet that held the resolver role before transfer. The primary loss-producing step is then performed by a separate ordinary local user through the Portal's own native name-transfer flow after the Portal resolves the poisoned name to the attacker; it is not an attacker-controlled balance adjustment. The additional ETH payment is also performed by a separate ordinary local account after reading the real Portal output.

The exploit is highly reproducible: the transfer and unauthorized record write are mined in consecutive blocks in the E2E run, and the final resolver state is read directly from the chain. The negative control shows that the current buyer cannot perform the same action without a resolver role.

No buyer signature is needed to create the wrong resolution; a later ordinary user must choose to send funds, as with any wrong-recipient resolution. The PoC makes that later action explicit and quantifies its exact local balance effect.

Under the supplied scope, the correct category is Web & App and the correct claimed severity is Critical, because the demonstrated application outcome is exactly a wrong ENS address being resolved/rendered to an attacker-controlled recipient. The report uses scope #371 for this classification and clearly distinguishes reproducible local-fork payment evidence from a claim of live production loss.

References

  • Scope and severity: #scope, Critical impact #371; in-scope asset apps/portal (the Explorer app).
  • Known issues: (provided competition artifact). This finding is not listed. QA-01 covers role combinations that cause later profile/primary-name errors and expressly says a demonstrated security consequence such as unintended authority would be a new finding. WEB-1257 concerns a previous owner being unable to set a subname primary after a parent transfer; it does not cover a former owner successfully writing the transferred name's resolver and redirecting addr(60). WEB-1305 concerns a V2-to-V1 role transfer hanging. R2-03 concerns a seven-day full-authority HCA session. EXP-4337-003 concerns a caller-supplied from mismatch. None is the same root cause or impact.
  • Program description: (provided competition artifact), including the priority on directing users to transfer funds to an unintended address.
  • Production authorization: useCanEditRecords.ts.
  • Production transfer: SendNameForm.tsx, buildTransferPlan.ts, useTransferName.ts, transferToken.ts, and setEthAddress.ts.
  • Production recipient resolution: useAddressResolution.ts and getResolvedAddress.ts.
  • Production record write: saveRecords.ts.
  • Runnable reproduction source: the added e2e/projects/portal/tests/audit-stale-resolver-access.spec.ts file is reproduced in full below for submission and fresh-clone use; it is not present in the audited commit's GitHub tree because it is the PoC artifact added for this report.

Proof of Concept

This is a runnable Playwright E2E attack test, not a unit test and not a source-text assertion. It starts the local fork and Portal, uses the real browser routes and transaction modal, submits real transactions through the Portal's production helpers and transaction manager, reads the resulting chain state with viem, verifies the final wrong address through the Portal's real address-resolution route, uses that wrong resolution in the Portal's own native name-transfer flow to produce a victim asset loss, and completes a separately labelled downstream local-wallet payment using the exact address rendered by that route.

Target, environment, and repository state

  • Repository: audit-comp-ens.
  • Revision: 1c9b47f18fcddd2e864dfe385c4171061c9811ae on audit-comp-ready.
  • Network: chain ID 11155111 on the repository's isolated local Anvil Sepolia fork.
  • Required local endpoints: Anvil 127.0.0.1:8545, Portal 127.0.0.1:3001, Panoptes GraphQL 127.0.0.1:5655.
  • Browser: Playwright Chromium installed by the repository's E2E package.
  • The fixture mnemonic/accounts are local test accounts only. Do not use them or any generated key against a live network.

Attacker model and fixture/setup authority

The attack actor is the former seller, who legitimately owns the ENS V2 token and holds the resolver roles before transfer. The attack actor controls the recipient address written after transfer. The buyer is a separate local account.

user4 independently owns a second ENS V2 name and is the victim of the native Portal transfer; the same account is used for the optional ETH settlement after the name transfer.

Setup-only operations register the fresh names, deploy resolver proxies, initialize role state, and fund local accounts; those operations are not presented as attacker powers. The attack phase uses only the seller's normal Portal wallet and the buyer's normal transfer acceptance is not needed because the seller submits the token transfer in this local fixture.

Fresh-repository reproduction instructions

Use a clean checkout at the target revision. If the repository is already present:

Shell
cd /path/to/audit-comp-ens
git checkout audit-comp-ready
git checkout 1c9b47f

The original report as published on Immunefi, by n3310y. 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 Portal's edit-authorisation check for permissioned resolvers only verifies that the connected wallet holds a resolver role, and the transfer flow never revokes the seller's roles when the name token moves.

Impact

The buyer's name persistently resolves to an attacker-controlled address, and the buyer cannot repair it through the Portal because the role check denies them; the report also demonstrates a separate victim's name being transferred to the attacker through the Portal's own transfer flow.

What the attacker needed

Name uses a dedicated PermissionedResolver; seller transfers without detaching resolver; attacker is the former owner

The fix

The Portal should require current token ownership for permissioned-resolver edits and revoke the seller's resolver roles (or force resolver detachment) when a name is transferred.

How it was found

  1. Set up a dedicated PermissionedResolver for the seller with all roles.
  2. Set a baseline ETH address record on the name through the Portal.
  3. Transfer the name to the buyer with the detach-resolver option turned off.
  4. Confirm on-chain that the buyer owns the token but the seller still holds the resolver roles.
  5. Reconnect as the former owner and edit the ETH record to an attacker address.
  6. Visit the name's address page and see the attacker address rendered.

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 point to an Ethereum address, so people use them instead of long hex addresses. This report says that after a name is sold, the old owner can still edit where the name points, because the app checks an old permission instead of who owns the name now. A user who trusts the name could then send funds to the wrong address.

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 n3310y

View all

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