Portal reparses a two dot raw label and authorizes a different four label ens name
The ENS Portal resolver overview kept only a node's dotted display string, so a single raw on-chain label containing interior dots was re-encoded by the wallet request builder as a multi-label DNS name. An attacker who registered such a look-alike label could get the victim to approve a role grant that actually landed on the victim's genuine hierarchical name, letting the attacker redirect its resolution.
Originally disclosed on Immunefi
- Disclosed after under an hour
92110 w a high portal reparses a two dot raw label and authorizes a different four label ens name
Submitted on Sep 7th 2026 at 09:08:55 UTC by @yaohao159123 for Audit Competition | ENS
- Report ID: #92110
- Report Type: Websites & Apps
- Report severity: High
- 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
Evidence-led summary
One successful Portal Add User action produced one wallet request with selector 0xbbd9abb5, role value 1, and grantee 0x70997970C51812dc3A010C7d01b50e0d17dc79C8. Although the victim selected the displayed flat-label object S, alpha.beta.gamma.eth, the request contained 0x05616c70686104626574610567616d6d610365746800, the DNS packet for the victim's four-label hierarchical object T. The receipt succeeded, the attacker gained ROLE_SET_ADDR only on T, and an immediate attacker setAddr(T) changed T's resolved address. S remained unauthorized and unchanged.
Those measured facts follow from an identity-loss boundary in Portal. The resolver overview begins with an indexed ENSv2 node, but the selection and transaction state retain only its dotted display string. The grant helper gives that string to ENSJS, and Viem treats both interior dots as DNS label separators. Thus the application cannot preserve the raw label's boundary. An attacker can publicly register the single raw label alpha.beta.gamma under .eth, deliver that object to the victim, and associate it with the victim's resolver. Portal renders S with the same scalar as the separately owned hierarchy alpha below beta.gamma.eth; one ordinary victim confirmation then grants the attacker authority over T. The wrong resource is created by the application's transaction argument, not merely suggested by ambiguous text.
Vulnerability Details
The governing invariant is object continuity: the typed registry/DNS object selected in the interface must be the object serialized into the wallet request. Text that happens to display identically is insufficient proof of identity because DNS boundaries are structural bytes. Portal violates this invariant after selection and before calldata construction.
Resource identity versus display equality
The collision is visible when the structural facts are compared directly:
| Evidence | S: attacker-created decoy | T: victim's genuine name |
|---|---|---|
| Label structure | one raw label alpha.beta.gamma below .eth |
alpha below beta.gamma.eth |
| DNS wire bytes | 0x10616c7068612e626574612e67616d6d610365746800 |
0x05616c70686104626574610567616d6d610365746800 |
| Registry token, namehash, and role resource | distinct from T | distinct from S |
| Portal display scalar | alpha.beta.gamma.eth |
alpha.beta.gamma.eth |
For S, both interior dots are label data. For T, both characters mark DNS boundaries. The indexer named by the target's end-to-end configuration constructs a displayed name as label + "." + parent and keys names rows by (chain, namehash). It can therefore expose the flat object's distinct row with this shared spelling. This public-chain preparation does not make the indexer the vulnerable asset: the in-scope Portal is responsible for throwing away the row's typed identity before building the transaction.
Reconstructed exploit sequence
The attacker preparation consists only of paid public registrar operations over attacker-controlled state:
- The victim already owns hierarchical T,
alpha.beta.gamma.eth, and manages its active PermissionedResolver R. - Through the public
ETHRegistrar.commit()andregister()flow, the attacker registers the raw, single labelalpha.beta.gammaunder.eth, assigns S to the victim, and sets R as S's resolver. - The resolver overview's indexed row presents S as
alpha.beta.gamma.eth. - The attacker asks the victim to provide Set Address Manager access for the delivered object.
The victim then follows the normal product path once:
- While connected, the victim opens Roles, clicks Add User, supplies the attacker address, chooses the shown
alpha.beta.gamma.eth, enables only Set Address Manager, and proceeds through the confirmationGrant resolver roles for alpha.beta.gamma.eth. - Portal calls
authorizeNameRoles(T_dns, ROLE_SET_ADDR, attacker, true), whereT_dnsis the hierarchical packet rather than S's flat packet. - The successful receipt gives the attacker the T role. The attacker can then invoke
setAddrfor T and point the genuine name at the attacker-controlled address.
This route needs no failed call, Retry action, race, stale index, hostile resolver, compromised key, pre-existing attacker privilege, or second victim interaction. Registration is preparation; the exploit-side user action is one documented Add User flow and one successful approval.
Identity-loss and serialization chain
The source establishes the failure as a continuous dataflow:
apps/portal/src/features/resolver/hooks/useResolverOverview.ts:33-38reduces each resolver node toid,name,owner, andresolver.- The query at
apps/portal/src/features/resolver/hooks/useResolverOverview.ts:75-85does not request the availablelabelName,labelhash,tokenId,canonicalId,normalizedName, orisNormalizedvalues. It also retains neither a registry address nor canonical DNS bytes. apps/portal/src/features/resolver/components/ResolverAddUserSheet.tsx:127typesselectedNodeas a string. At:186, it maps candidate nodes ton.name; at:205, it snapshots only{ name, account, roles }; at:321, it displays that scalar; and at:327-334, it sends the same scalar to the grant builder. By then, no label vector, token identity, registry address, role resource, or canonical packet can identify S.apps/portal/src/features/resolver/helpers/grantResolverRoles.ts:45-60passes every non-empty selected string to ENSJS usingscope: 'name'.- The pinned builder calls
packetToBytes(name)atapps/portal/node_modules/@ensdomains/ensjs/src/actions/wallet/v2/grantResolverRoles.ts:96-98, then createsauthorizeNameRolesat:124-135. - Viem's
apps/portal/node_modules/viem/utils/ens/packetToBytes.ts:38splits on every interior dot. For"alpha.beta.gamma.eth", it necessarily emits0x05 alpha | 0x04 beta | 0x05 gamma | 0x03 eth | 0x00, not0x10 alpha.beta.gamma | 0x03 eth | 0x00. packages/transaction-manager/src/actors/eoa-transport.actor.ts:52-60forwards the prepared destination and data unchanged to the wallet.
The decisive transformation is therefore:
selected node object (flat label "alpha.beta.gamma" under .eth)
-> retained as display string "alpha.beta.gamma.eth"
-> packetToBytes("alpha.beta.gamma.eth") = alpha | beta | gamma | eth
-> authorizeNameRoles(0x05616c70686104626574610567616d6d610365746800, ROLE_SET_ADDR, attacker, true)
-> grant lands on the genuine hierarchical name T
Runtime evidence
The end-to-end run used the real frozen Portal UI and real contracts-v2 deployments on a local Anvil chain configured with the Sepolia chain ID; it made no Sepolia RPC writes. The target-provided mock-wallet connector established only the victim EOA. At the out-of-scope GraphQL boundary, the runner supplied the reviewed indexer behavior from its shipped schema and upsert SQL. Portal's interface, transaction helper, pinned ENSJS/Viem encoder, transaction manager, wallet RPC, mined receipt, resolver state, and attacker write all executed without transaction-logic patches.
The browser witness recorded:
displayed/selected object: alpha.beta.gamma.eth (flat label S)
wallet requests sent: 1 (eth_sendTransaction)
captured calldata selector: 0xbbd9abb5 authorizeNameRoles(bytes,uint256,address,bool)
calldata DNS packet: 0x05616c70686104626574610567616d6d610365746800 (T: alpha | beta | gamma | eth)
calldata roles: 1 (ROLE_SET_ADDR)
calldata grantee: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (attacker)
confirmation text: Grant resolver roles for alpha.beta.gamma.eth
local transaction: 0x011ac464a5ba93b9ff316c122d012e71d44dd838b07217b4772e9ed2ca4295f7
receipt: success (0x1)
Portal page errors: 0
The wallet request byte-for-byte matched the mined transaction input. It included T's hierarchical packet and omitted S's flat packet. The terminal authorization results were:
| State | Before victim approval | After successful receipt |
|---|---|---|
Attacker ROLE_SET_ADDR on T (genuine name) |
false | true |
Attacker ROLE_SET_ADDR on S (flat decoy) |
false | false |
Attacker setAddr(T) |
reverts | succeeds |
addr(T) |
- | attacker address |
addr(S) |
- | zero |
The run used Portal commit cda79acaad59711b943fc68207ebb3f1d0ff8596 and contracts-v2 commit 8d9dcca8a7703e5d15958d628c39579d3aa789e1. The fixture created T through ethRegistry -> gammaRegistry -> betaRegistry, then the attacker used the public registrar to register S to the victim with the same resolver. This is a legal initial state: the attacker starts without a resolver role and cannot call setAddr on either object. The selected S packet was 0x10616c7068612e626574612e67616d6d610365746800, while the captured and mined request carried T's four-label packet. Revoking T removed the attacker's write capability. A control grant using S's correct flat packet then authorized S alone and left T unauthorized.
Negative and positive controls
Two controls isolate the wrong DNS boundary from permissive resolver behavior:
- Revoking the role on T causes the attacker's next
setAddr(T)to revert, proving the attacker did not have default write permission. - Granting with S's correct flat DNS packet sets
ROLE_SET_ADDRonly on S, leaves T unauthorized, and enables an attacker write to S. The role implementation behaves correctly when it receives the intended packet.
Together, the pre-state, T-only delta, revocation, and correct-packet control attribute the capability transfer to Portal's reconstructed name argument.
Scope of the GraphQL substitution
The intercepted GraphQL response supplies only the external indexer row, matching the reviewed image's schema, (chain, namehash) upsert key, and label + "." + parent name construction. It neither fabricates the in-scope transformation nor changes transaction execution. Once Portal receives a row, all relevant layers run for real.
More importantly, a fully accurate indexer could return S and T as separate typed rows and this code path would still collapse both rows to the same name string. Because the selected value contains no typed identity, Portal cannot select S's canonical bytes at the grant boundary. The indexer provides attacker-created state; the Portal's lossy projection and reparsing create the wrong-resource authorization.
Remediation and regression requirements
The fix should preserve resource identity from query through wallet request:
- Query and type a stable identity bundle for each resolver node, including registry address, token or canonical ID, raw label or label vector, namehash, resolver, and canonical DNS wire bytes.
- Keep the selected object, or an opaque stable key resolving to it, instead of assigning
node.nameto selection state. - Construct authorization calldata from the selected object's canonical packet or resource; display text must never be reparsed into authority-bearing bytes.
- Before confirmation and again before submission, verify that the typed object remains attached to the selected resolver and that any display round trip yields exactly the same packet.
- Reject ambiguous and non-round-trippable records, and expose enough label/registry identity for same-spelled resources to be distinguished.
- Add a regression fixture containing both the raw flat label
alpha.beta.gammaand the hierarchyalpha.beta.gamma.eth. Selecting either must never authorize the other, and the test must compare the exact DNS packets rather than their shared display string.
Impact Details
The recommended primary impact is Malicious interactions with an already-connected wallet (modifying transaction arguments or parameters / submitting malicious transactions) - Critical. The demonstrated terminal result also maps to Subdomain takeover without already-connected wallet interaction - High.
The Critical mapping follows from the transaction itself. The user selects S, while Portal constructs a request in which the authority-bearing DNS argument names T. This is an application-generated substitution of the authorization resource, delivered through the already-connected wallet. The visual string is not merely misunderstood: it is the lossy value Portal chose to transform, and that transformation changes the target bytes.
The High mapping follows from the measured post-state. Before approval, the attacker cannot write either object. After Portal's one successful transaction, the attacker alone receives ROLE_SET_ADDR on the victim's genuine T and can immediately redirect its resolution without another victim wallet action. No theft, NFT transfer, purchase made through incorrect resolution, or permanent irreversibility is asserted. The owner can revoke the role after discovery, but until then the exclusive attacker capability and immediate redirect are real, and the product gives no warning that the grant reached an object different from the selected one.
Distinction from public issue EXP-INPUT-005
The public description of EXP-INPUT-005 concerns input validators that accept text later rejected or transformed by normalization, including homoglyphs, bidirectional/control characters, and a single leading or trailing dot. It characterizes the practical consequence as homograph-like display confusion rather than incorrect resolution. This report has a different ingress, root, sink, and demonstrated result:
| Dimension | Public EXP-INPUT-005 | This report |
|---|---|---|
| Entry point | validator accepts deceptive name text | victim opens an already-registered on-chain object in Resolver Roles; no name-input validator participates |
| Character condition | homoglyph, bidi/control character, or one leading/trailing dot | interior dot bytes inside one raw on-chain label, later interpreted as DNS separators |
| Root failure | validation disagrees with normalization | typed node identity is discarded and display text is reparsed as a different object |
| Security sink | confusing UI rendering | successful authorizeNameRoles call against another authorization resource |
| Terminal outcome | publicly limited to display confusion | attacker gains ROLE_SET_ADDR over the genuine name and redirects it |
| Narrow corrective action | align the validator and normalizer or reject the text | maintain typed object identity through calldata; never derive the resource from display text |
The private EXP-INPUT-005 ticket and any non-public fix are unavailable, so this comparison is necessarily limited to the program's public statement. The same limitation prevents a guarantee that no private report has overlapping breadth.
References and source state
Scope and revision facts:
- In-scope asset:
apps/portal(Explorer app / Websites & Apps). - Frozen competition revision used by the PoC:
cda79acaad59711b943fc68207ebb3f1d0ff8596. - Public
audit-comp-readyhead reviewed on 2026-08-27:1c9b47f18fcddd2e864dfe385c4171061c9811ae. - The public changes after the frozen revision are limited to Hono/package-manifest and lockfile updates; no public typed-identity or grant-builder correction is present.
- The executed frozen copies of
useResolverOverview.ts,ResolverAddUserSheet.tsx,grantResolverRoles.ts, and the ENSJS grant builder match the competition source.
Links:
- Program scope: https://immunefi.com/audit-competition/audit-competition-ens/scope/
- In-scope Portal: https://github.com/immunefi-team/audit-comp-ens/tree/audit-comp-ready/apps/portal
- Resolver overview query/model: https://github.com/immunefi-team/audit-comp-ens/blob/audit-comp-ready/apps/portal/src/features/resolver/hooks/useResolverOverview.ts
- Add User sheet (selection, confirmation, dispatch): https://github.com/immunefi-team/audit-comp-ens/blob/audit-comp-ready/apps/portal/src/features/resolver/components/ResolverAddUserSheet.tsx
- Grant helper: https://github.com/immunefi-team/audit-comp-ens/blob/audit-comp-ready/apps/portal/src/features/resolver/helpers/grantResolverRoles.ts
- Transaction manager (in-scope package): https://github.com/immunefi-team/audit-comp-ens/tree/audit-comp-ready/packages/transaction-manager
Proof of Concept
Proven properties
The executable source embedded in this report drives the unmodified frozen Portal through one ordinary Add User operation against real contracts-v2 deployments on an isolated Anvil chain. The selected object S is one raw label, alpha.beta.gamma, under .eth; the genuine target T is the hierarchy alpha | beta | gamma | eth. Portal displays both structures as alpha.beta.gamma.eth.
The run proves every decisive boundary in one trace: the victim selects S and only Set Address Manager; Portal emits exactly one wallet request; the request carries T's DNS packet rather than S's; the local transaction succeeds; only T gains the attacker's role; and the attacker immediately exercises that role against T. Revocation removes the capability, while a correct-flat-packet control authorizes only S.
No Sepolia transaction is broadcast, no production user or site is contacted, and no real user key is used. The local chain uses Sepolia's chain ID solely because Portal enforces that network identifier.
Reproduction steps and environment
Prerequisites are macOS or Linux; Git; Foundry (anvil, forge, and cast); Node 22 with pnpm 10; Python 3; and Playwright with Chromium. The only source dependencies are the two official repositories and exact revisions shown below. The four bundle files used by the run are all embedded in this report: setup-foundry-toml.sh, foundry.toml.template, script/DeployDottedPortalFixture.s.sol, and run_continuous_portal_anvil.py.
Save the four embedded files with those relative names, then run these commands from the directory containing them:
git clone https://github.com/immunefi-team/audit-comp-ens.git audit-comp-ens
git -C audit-comp-ens checkout --detach cda79acaad59711b943fc68207ebb3f1d0ff8596
pnpm --dir audit-comp-ens install --frozen-lockfile
git clone https://github.com/ensdomains/contracts-v2.git contracts-v2
git -C contracts-v2 checkout --detach 8d9dcca8a7703e5d15958d628c39579d3aa789e1
git -C contracts-v2 submodule update --init --recursive
python3 -m venv .venv
.venv/bin/python -m pip install playwright
.venv/bin/python -m playwright install chromium
chmod +x setup-foundry-toml.sh
CONTRACTS_V2_ROOT="$PWD/contracts-v2/contracts" ./setup-foundry-toml.sh
ENS_FROZEN_SOURCE_ROOT="$PWD/audit-comp-ens" .venv/bin/python run_continuous_portal_anvil.py
CONTRACTS_V2_ROOT must contain the contracts-v2 src/ and lib/ directories. ENS_FROZEN_SOURCE_ROOT must contain apps/portal. The runner resolves anvil, forge, cast, and pnpm from PATH; optional ANVIL_BIN, FORGE_BIN, CAST_BIN, NODE_BIN_DIR, and CHROMIUM_BIN values may override those executable locations. It reserves dynamic localhost ports, creates its own artifact directory, and terminates Portal and Anvil on exit.
The setup helper is complete:
#!/usr/bin/env bash
# Generate foundry.toml for the PoC project from foundry.toml.template.
# CONTRACTS_V2_ROOT must point at the `contracts/` directory inside a
# contracts-v2 checkout (the tree that contains src/ and lib/).
set -euo pipefail
if [[ -z "${CONTRACTS_V2_ROOT:-}" ]]; then
echo "set CONTRACTS_V2_ROOT to the contracts/ directory of a contracts-v2 checkout" >&2
echo 'example: CONTRACTS_V2_ROOT="$PWD/contracts-v2/contracts" ./setup-foundry-toml.sh' >&2
exit 1
fi
if [[ ! -d "${CONTRACTS_V2_ROOT}/src" || ! -d "${CONTRACTS_V2_ROOT}/lib" ]]; then
echo "CONTRACTS_V2_ROOT must contain src/ and lib/ (got: ${CONTRACTS_V2_ROOT})" >&2
exit 1
fi
sed "s|{{CONTRACTS_V2_ROOT}}|${CONTRACTS_V2_ROOT}|g" foundry.toml.template > foundry.toml
echo "wrote foundry.toml for CONTRACTS_V2_ROOT=${CONTRACTS_V2_ROOT}"
The corresponding Foundry template is complete:
[profile.default]
src = "src"
test = "test"
out = "out"
cache_path = "cache"
libs = ["{{CONTRACTS_V2_ROOT}}/lib"]
evm_version = "cancun"
optimizer = true
optimizer_runs = 200
fs_permissions = [{ access = "read-write", path = "./artifacts" }]
remappings = [
"~src/={{CONTRACTS_V2_ROOT}}/src/",
"~test/={{CONTRACTS_V2_ROOT}}/test/",
"forge-std/={{CONTRACTS_V2_ROOT}}/lib/forge-std/src/",
"@openzeppelin/contracts/={{CONTRACTS_V2_ROOT}}/lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/={{CONTRACTS_V2_ROOT}}/lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts-v5/={{CONTRACTS_V2_ROOT}}/lib/openzeppelin-contracts/contracts/",
"@ens/contracts/={{CONTRACTS_V2_ROOT}}/lib/ens-contracts/contracts/",
"@ens/contracts/utils/LibMem/={{CONTRACTS_V2_ROOT}}/src/utils/",
"@ensdomains/buffer/={{CONTRACTS_V2_ROOT}}/lib/buffer/",
"@ensdomains/verifiable-factory/={{CONTRACTS_V2_ROOT}}/lib/verifiable-factory/src/",
"@unruggable/gateways/={{CONTRACTS_V2_ROOT}}/lib/unruggable-gateways/",
"solady/={{CONTRACTS_V2_ROOT}}/lib/solady/src/",
"{{CONTRACTS_V2_ROOT}}/lib/ens-contracts/:@openzeppelin/contracts/={{CONTRACTS_V2_ROOT}}/lib/openzeppelin-contracts-v4/contracts/",
"{{CONTRACTS_V2_ROOT}}/lib/ens-contracts/:@ensdomains/solsha1/contracts/={{CONTRACTS_V2_ROOT}}/lib/solsha1/contracts/",
"{{CONTRACTS_V2_ROOT}}/lib/ens-contracts/:@unruggable/gateways/={{CONTRACTS_V2_ROOT}}/lib/unruggable-gateways/contracts/"
]
Assertion oracles
Any failed invariant makes the runner exit non-zero and retain a failure result. A complete run prints status: PASS. Its stable acceptance oracles are:
selected/displayed object = alpha.beta.gamma.eth (flat S)
selected S DNS packet = 0x10616c7068612e626574612e67616d6d610365746800
wallet/mined T packet = 0x05616c70686104626574610567616d6d610365746800
wallet eth_sendTransaction count = 1
Portal page errors = 0
receipt status = 0x1
before.nestedRole = false
before.flatRole = false
before.attackerSetAddrDenied = true
afterPortal.nestedRole = true
afterPortal.flatRole = false
afterPortal.nestedAddr = attacker
afterPortal.flatAddr = zero
controls.setAddrDeniedAfterRevoke = true
controls.nestedRoleAfterFlatGrant = false
controls.flatRoleAfterFlatGrant = true
The captured wallet request must byte-equal the transaction input mined by Anvil. It must contain T's packet and exclude S's packet. The role and address controls must isolate the capability to the exact packet granted.
Execution result
The structure-fixed bundle was rerun from the embedded source. It returned status: PASS, emitted one wallet request, produced no Portal page errors, and mined local transaction 0x011ac464a5ba93b9ff316c122d012e71d44dd838b07217b4772e9ed2ca4295f7 with receipt status 0x1 in block 0x16.
Before Portal, the attacker held no Address role on S or T and setAddr(T) reverted. After Portal, T's role was true, S's role remained false, addr(T) equaled the attacker address, and addr(S) remained zero. Revocation restored denial. Granting the correct S packet then made only S writable and left T unauthorized.
The five screenshots cover the Roles page, S selection with only Set Address Manager, transaction overview, confirmation text Grant resolver roles for alpha.beta.gamma.eth, and successful completion. The machine-readable witness is continuous-result.json; fixture.json and flat-registration-receipt.json record the object construction and public registration.
The complete Foundry deployment fixture is:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {Script} from "forge-std/Script.sol";
import {NameCoder} from "@ens/contracts/utils/NameCoder.sol";
import {VerifiableFactory} from "@ensdomains/verifiable-factory/VerifiableFactory.sol";
import {EACBaseRolesLib} from "~src/access-control/libraries/EACBaseRolesLib.sol";
import {ETHRegistrar} from "~src/registrar/ETHRegistrar.sol";
import {
DiscountPoint,
PaymentRatio,
StandardRentPriceOracle
} from "~src/registrar/StandardRentPriceOracle.sol";
import {PermissionedRegistry} from "~src/registry/PermissionedRegistry.sol";
import {RegistryRolesLib} from "~src/registry/libraries/RegistryRolesLib.sol";
import {IRegistry} from "~src/registry/interfaces/IRegistry.sol";
import {PermissionedResolver} from "~src/resolver/PermissionedResolver.sol";
import {PermissionedResolverLib} from "~src/resolver/libraries/PermissionedResolverLib.sol";
import {IContractNamer} from "~src/reverse-registrar/interfaces/IContractNamer.sol";
import {LabelStore} from "~src/utils/LabelStore.sol";
import {MockERC20} from "~test/mocks/MockERC20.sol";
contract DeployDottedPortalFixture is Script {
string internal constant FLAT_LABEL = "alpha.beta.gamma";
string internal constant NESTED_NAME = "alpha.beta.gamma.eth";
address internal victim;
address internal attacker;
PermissionedRegistry internal ethRegistry;
PermissionedRegistry internal gammaRegistry;
PermissionedRegistry internal betaRegistry;
PermissionedResolver internal resolver;
ETHRegistrar internal registrar;
MockERC20 internal paymentToken;
uint256 internal genuineTokenId;
uint256 internal flatBaseId;
uint256 internal flatResource;
uint256 internal nestedResource;
bytes internal flatDns;
bytes internal nestedDns;
bytes32 internal flatNode;
bytes32 internal nestedNode;
bytes32 internal commitment;
bytes32 internal secret;
uint64 internal duration;
function run() external {
uint256 victimKey = vm.envUint("VICTIM_PRIVATE_KEY");
uint256 attackerKey = vm.envUint("ATTACKER_PRIVATE_KEY");
victim = vm.addr(victimKey);
attacker = vm.addr(attackerKey);
vm.startBroadcast(victimKey);
_deployNames();
_deployRegistrar();
vm.stopBroadcast();
vm.startBroadcast(attackerKey);
paymentToken.approve(address(registrar), type(uint256).max);
vm.stopBroadcast();
_prepareFixtureValues();
_writeFixture();
}
function _deployNames() internal {
LabelStore labelStore = new LabelStore(IContractNamer(address(0)));
ethRegistry = new PermissionedRegistry(labelStore, victim, EACBaseRolesLib.ALL_ROLES);
gammaRegistry = new PermissionedRegistry(labelStore, victim, EACBaseRolesLib.ALL_ROLES);
betaRegistry = new PermissionedRegistry(labelStore, victim, EACBaseRolesLib.ALL_ROLES);
gammaRegistry.setParent(ethRegistry, "gamma");
betaRegistry.setParent(gammaRegistry, "beta");
VerifiableFactory factory = new VerifiableFactory();
PermissionedResolver implementation = new PermissionedResolver(victim);
bytes memory initData = abi.encodeCall(
PermissionedResolver.initialize,
(victim, EACBaseRolesLib.ALL_ROLES, new bytes[](0))
);
resolver = PermissionedResolver(
factory.deployProxy(address(implementation), uint256(keccak256(initData)), initData)
);
uint64 expiry = uint64(block.timestamp + 365 days);
ethRegistry.register(
"gamma",
victim,
gammaRegistry,
address(resolver),
EACBaseRolesLib.ALL_ROLES,
expiry
);
gammaRegistry.register(
"beta",
victim,
betaRegistry,
address(resolver),
EACBaseRolesLib.ALL_ROLES,
expir
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 resolver overview query and selection state retained only the node's display name string, discarding typed identity such as raw label bytes, token ID and canonical DNS packet, so the grant builder reparsed the text and split interior dots into separate labels.
Impact
After one victim approval the attacker gains the Set Address Manager role on the victim's genuine name and can redirect its resolution, though the owner can revoke the role after discovery.
What the attacker needed
Victim owns a hierarchical name; attacker registers a look-alike raw label; victim approves one role grant
The fix
The portal should carry a typed identity bundle (registry address, token or canonical ID, raw label bytes, namehash and canonical DNS packet) from query through selection to calldata, and never reparse display text into authority-bearing bytes.
How it was found
- The victim owns the hierarchical name and manages its active resolver.
- The attacker registers the single raw label containing interior dots under .eth, assigns it to the victim and sets the victim's resolver on it.
- The resolver overview shows the attacker's object with the same dotted spelling as the victim's genuine name.
- The victim opens Roles, clicks Add User, enters the attacker address, selects the displayed name and enables only Set Address Manager.
- The victim confirms the grant, and the wallet request carries the genuine hierarchical name's DNS packet instead of the selected flat label's packet.
- The transaction succeeds, giving the attacker the role on the genuine name, which the attacker then redirects with a set address call.
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 name like alpha.beta.gamma.eth can be built two ways: one single label that literally contains dots, or three separate labels nested under .eth. Both look identical on screen. The portal remembered only the printed text, so when it built the wallet transaction it split on the dots and authorised the wrong name.
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.