Explorer checkout shows a $0.00 total, deletes the approval step, and the registrar charges the full rent price the user was never shown
When the Explorer's price read for a payment token fails, the checkout substitutes a default price of zero, so the picker shows $0.00, marks tokens as available on an empty wallet, and drops the ERC-20 approval step, while the registrar still charges the real rent price on-chain. An attacker who can make the price read fail (for example by exhausting or blocking the RPC) could get a user to sign a transaction whose displayed total does not match the amount actually charged.
- Disclosed after under an hour
92608 w a medium explorer checkout shows a 0 00 total deletes the approval step and the registrar charges the full rent price the user was never shown
Submitted on Sep 10th 2026 at 21:45:54 UTC by @v4rvl for Audit Competition | ENS
- Report ID: #92608
- 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
Summary
buildTokenData substitutes DEFAULT_PRICE - a record whose total is 0n - for any payment token whose price read did not resolve. The Explorer's neverthrow query wrapper converts a failed price read into a thrown query, so query.data is undefined and the substitution fires. 0n then propagates as a real quoted price through three independent gates that all invert: the "Insufficient balance" guard becomes unreachable because balance < 0n is never true, the token row renders "available" and stays clickable on a wallet holding zero USDC and zero DAI, and the amount carried into the flow is 0n, so needsApproval = allowance < 0n is false and the ERC-20 approval step is removed from the transaction list. The registration summary above the picker fetches the same price under a different query key, so it can show the real total while the picker shows nothing. The user is shown $0.00 for a purchase that is not free, and the transaction submitted is a register / renew whose on-chain charge is the real price rather than the displayed one. Driven to its endpoint on a Sepolia fork: displayed total $0.00, wallet asked to sign approve(registrar, 8800023) for a step the modal no longer listed, registrar pulled 8000021 by transferFrom, buyer's USDC balance 100000000 to 91999979, name registered to the buyer on the ENSv2 registry. The multi-name renewal picker in the same codebase blocks this exact condition and its code comment names the consequence.
Root cause
The substitution. apps/portal/src/features/register/utils/tokenData.ts:13-19,46-61:
export const DEFAULT_PRICE: TokenPrice = {
total: 0n,
base: 0n,
premium: 0n,
decimals: USDC_DECIMALS,
hasPremium: false,
}
export function buildTokenData(
tokens: readonly TokenInput[],
prices: readonly (TokenPrice | undefined)[],
balances: readonly bigint[],
allowances: readonly bigint[],
): TokenWithPriceAndBalance[] {
return tokens.map((token, i) => {
const price = prices[i]
return {
...token,
price: isTokenPrice(price) ? price : DEFAULT_PRICE,
How undefined gets there. packages/utils/src/tanstack-query/neverthrow/query.ts:132-141 turns a neverthrow Err into a throw, so a failed price read leaves the query in error state with data === undefined:
const queryFn =
typeof rawQueryFn === 'function'
? (context: QueryFunctionContext<QueryKey>) =>
rawQueryFn(context).match(
(value) => value,
(error) => {
throw error
},
)
: rawQueryFn
getRegistrationPrice and getRenewalPrice both return Err(GetRegistrationPriceError) when the on-chain read fails (apps/portal/src/features/register/hooks/useRegistrationPrice.ts:81-85, useRenewalPrice.ts:36-45; the latter's doc comment states pricing "reverts if the name isn't renewable via the renewer").
The picker checks only isLoading, never isError. apps/portal/src/features/register/components/PaymentTokenPicker.tsx:109-115,144-153:
if (
balancesQuery.isLoading ||
allowancesQuery.isLoading ||
priceQueries.some((query) => query.isLoading)
) {
return <Skeleton />
}
const tokenData = buildTokenData(
PAYMENT_TOKENS,
priceQueries.map((query) => query.data),
balances,
allowances,
)
const noSupportedTokenHasSufficientBalance = tokenData.every(
(token) => token.balance < token.price.total,
)
The three gates that invert. apps/portal/src/features/register/components/PaymentTokenList.tsx:34,41,60-64:
const hasSufficientBalance = token.balance >= token.price.total
disabled={!hasSufficientBalance || isRegistering}
{hasSufficientBalance ? (
<p className="text-muted-foreground text-xs">available</p>
) : (
<p className="text-destructive text-xs">Insufficient balance</p>
)}
apps/portal/src/features/register/components/PaymentTokenSection.tsx:42-46 hands the zero straight to the flow:
const handleBuyName = () => {
if (selectedTokenData) {
onConfirm(selectedTokenData.address, selectedTokenData.price.total)
}
}
apps/portal/src/features/register/hooks/useRegistrationTransactions.ts:137-140,230-254,311-313:
const needsApproval =
!savedParams ||
allowanceQuery.data === undefined ||
allowanceQuery.data < savedParams.tokenPrice
if (needsApproval) {
steps.push({
id: REGISTRATION_TX_IDS.approve,
const paid = savedParams
? formatPriceDisplay(savedParams.tokenPrice, savedParams.tokenDecimals)
: undefined
The renewal flow has the same twin. apps/portal/src/features/renew/components/ExtendNameModal.tsx:117-124 forwards token.price.total, and apps/portal/src/features/renew/hooks/useRenewalTransactions.ts:482 drops the approval on >=:
if (single.tokenAllowance >= single.tokenPrice) return [renewTx]
The sibling that gets it right. apps/portal/src/features/renew/components/multi-name-extension/MultiNamePaymentTokenPicker.tsx:119-137 refuses the same condition, and its comment states the consequence this report demonstrates:
// A settled-but-errored price read must NOT be treated as 0: that would
// understate a renewer's approval total (risking an on-chain revert) and make
// a token look affordable when it isn't. If any name's price failed to resolve,
// block selection and prompt a retry rather than price the batch wrong.
const pricesResolved =
usdcPriceQueries.every((q) => q.data && isPriceResult(q.data)) &&
daiPriceQueries.every((q) => q.data && isPriceResult(q.data))
if (!pricesResolved) {
return (
<MessageCard
variant="warning"
Why the summary and the picker can disagree. RegisterNameCheckoutSummary fetches the price with no token argument (apps/portal/src/features/register/components/RegisterNameSummary.tsx:58-64), while PaymentTokenPicker fetches it with token: token.address (PaymentTokenPicker.tsx:92-107). createQueryKey includes the parameters, so these are two independent cache entries for the same USDC price. One can be in success while the other is in error.
Steps to reproduce
- Connect a wallet to the Explorer and open
/<name>/registerfor an available.ethname. - Cause the picker's two price reads (
get-registration-pricewithtoken: USDCandtoken: DAI) to settle inerror. Any RPC failure on those two calls does it - a rate-limited or briefly unavailable provider is sufficient. The checkout summary's own price query uses a different key and is unaffected. - Observe the payment section: both tokens render with
availablebeneath the balance, and neither shows "Insufficient balance" - including on a wallet with a zero balance of both. - Select a token. The Register button enables.
- Click Register. The transaction modal opens listing "Approve payment" while the allowance read is still in flight, and drops that row once the read settles, leaving "Deploy resolver", "Submit commitment" and "Register name".
- The success screen's
paidvalue is$0.00. - Press through the modal. The registration completes. The registrar charges its real rent price by
transferFrom, and the wallet is prompted along the way to sign anapprovefor 110 percent of that price, a step the modal's list no longer contains. Measured on the fork: displayed$0.00,approvesigned for8800023,transferFrompulled8000021, USDC balance100000000to91999979, allowance0to800002, name owned by the buyer on the ENSv2 registry.
Proof of Concept
Proof of concept
/**
* A failed price read renders the checkout as $0.00, enables the buy button on
* an empty wallet, and deletes the approval step.
*
* Real production code driven here, unmodified:
* - features/register/utils/tokenData.ts buildTokenData / DEFAULT_PRICE
* - features/register/components/PaymentTokenList the rendered picker
* - features/register/utils/registrationPrice.ts formatPriceDisplay
* - packages/utils tanstack-query/neverthrow resultQueryOptions
* - features/register/hooks/useRegistrationPrice getRegistrationPrice (Err path)
*
* The only stand-in is the network: a queryFn that yields the same neverthrow
* `Err` the production `getRegistrationPrice` yields when the on-chain read
* fails. The Err -> `data === undefined` conversion under test is performed by
* the real `resultQueryOptions`, not by the test.
*/
import { QueryClient } from '@tanstack/react-query'
import { render, screen } from '@testing-library/react'
import { err } from 'neverthrow'
import { describe, expect, it } from 'vitest'
import { resultQueryOptions } from '@ens-apps/utils/tanstack-query/neverthrow'
import { PaymentTokenList } from '@/features/register/components/PaymentTokenList'
import { PAYMENT_TOKENS } from '@/features/register/constants/paymentTokens'
import { GetRegistrationPriceError } from '@/features/register/hooks/useRegistrationPrice'
import { formatPriceDisplay } from '@/features/register/utils/registrationPrice'
import {
buildTokenData,
DEFAULT_PRICE,
type TokenPrice,
} from '@/features/register/utils/tokenData'
/** The real price of the name, as the checkout summary renders it. */
const REAL_USDC_PRICE: TokenPrice = {
base: 5_000_000n,
premium: 0n,
total: 5_000_000n,
decimals: 6,
hasPremium: false,
}
const REAL_DAI_PRICE: TokenPrice = {
base: 5_000_000_000_000_000_000n,
premium: 0n,
total: 5_000_000_000_000_000_000n,
decimals: 18,
hasPremium: false,
}
/** Wallet holds no USDC and no DAI. */
const EMPTY_BALANCES = [0n, 0n] as const
/** No standing ERC-20 allowance to the registrar. */
const NO_ALLOWANCES = [0n, 0n] as const
describe('zero-price checkout', () => {
it('resultQueryOptions turns a production price Err into data === undefined', async () => {
const client = new QueryClient({
defaultOptions: { queries: { retry: false } },
})
const options = resultQueryOptions({
queryKey: ['portal2', 'price'] as const,
queryFn: () =>
err(
new GetRegistrationPriceError({
cause: new Error('execution reverted') as never,
}),
),
})
await expect(client.fetchQuery(options)).rejects.toBeInstanceOf(
GetRegistrationPriceError,
)
const state = client.getQueryState(['portal2', 'price'])
expect(state?.status).toBe('error')
expect(state?.data).toBeUndefined()
console.log(
'[STEP 1] query status =',
state?.status,
'| query.data =',
String(state?.data),
)
})
it('DEFECT: undefined price -> $0.00 total, enabled button on a 0-balance wallet, no approval', () => {
// PaymentTokenPicker.tsx:144-149 passes `priceQueries.map(q => q.data)`
// straight through. Both reads failed, so both are undefined.
const tokenData = buildTokenData(
PAYMENT_TOKENS,
[undefined, undefined],
EMPTY_BALANCES,
NO_ALLOWANCES,
)
expect(tokenData[0].price).toEqual(DEFAULT_PRICE)
expect(tokenData[0].price.total).toBe(0n)
expect(tokenData[1].price.total).toBe(0n)
// PaymentTokenPicker.tsx:151-153 - the "Insufficient balance" guard.
const noSupportedTokenHasSufficientBalance = tokenData.every(
(token) => token.balance < token.price.total,
)
expect(noSupportedTokenHasSufficientBalance).toBe(false)
render(
<PaymentTokenList
tokenData={tokenData}
selectedToken={null}
isRegistering={false}
onSelect={() => undefined}
/>,
)
// PaymentTokenList.tsx:34,41,60-64 - a wallet holding 0 USDC is told the
// token is available and the row is clickable.
const buttons = screen.getAllByRole('button')
expect(buttons).toHaveLength(2)
expect(buttons[0]).not.toBeDisabled()
expect(buttons[1]).not.toBeDisabled()
expect(screen.getAllByText('available')).toHaveLength(2)
expect(screen.queryAllByText('Insufficient balance')).toHaveLength(0)
// PaymentTokenSection.tsx:44 -> RegisterName.tsx:79 -> startFlow(addr, price)
const tokenPrice = tokenData[0].price.total
expect(tokenPrice).toBe(0n)
// useRegistrationTransactions.ts:311-313 - the amount shown as paid.
const paid = formatPriceDisplay(tokenPrice, tokenData[0].price.decimals)
expect(paid).toBe('$0.00')
// useRegistrationTransactions.ts:137-140 with a settled allowance read of 0.
const allowance = 0n
const needsApproval = allowance < tokenPrice
expect(needsApproval).toBe(false)
// useRenewalTransactions.ts:482 - the renewal flow's twin gate.
const renewalSkipsApproval = allowance >= tokenPrice
expect(renewalSkipsApproval).toBe(true)
// useRenewalTransactions.ts:157 - the amount the renewal would approve.
const renewalApproveAmount = tokenPrice * 2n
expect(renewalApproveAmount).toBe(0n)
console.log(
'[DEFECT] displayed total =',
paid,
'| buttons disabled =',
buttons.map((b) => (b as HTMLButtonElement).disabled).join(','),
'| insufficient-balance warnings =',
screen.queryAllByText('Insufficient balance').length,
'| needsApproval =',
needsApproval,
'| renewal approve amount =',
renewalApproveAmount.toString(),
)
})
it('CONTROL: same wallet, price reads succeed -> $5.00, disabled buttons, approval required', () => {
// ONE load-bearing condition changed: the two price reads resolve.
const tokenData = buildTokenData(
PAYMENT_TOKENS,
[REAL_USDC_PRICE, REAL_DAI_PRICE],
EMPTY_BALANCES,
NO_ALLOWANCES,
)
expect(tokenData[0].price.total).toBe(5_000_000n)
const noSupportedTokenHasSufficientBalance = tokenData.every(
(token) => token.balance < token.price.total,
)
expect(noSupportedTokenHasSufficientBalance).toBe(true)
render(
<PaymentTokenList
tokenData={tokenData}
selectedToken={null}
isRegistering={false}
onSelect={() => undefined}
/>,
)
const buttons = screen.getAllByRole('button')
expect(buttons).toHaveLength(2)
expect(buttons[0]).toBeDisabled()
expect(buttons[1]).toBeDisabled()
expect(screen.getAllByText('Insufficient balance')).toHaveLength(2)
const tokenPrice = tokenData[0].price.total
const paid = formatPriceDisplay(tokenPrice, tokenData[0].price.decimals)
expect(paid).toBe('$5.00')
const allowance = 0n
expect(allowance < tokenPrice).toBe(true)
expect(tokenPrice * 2n).toBe(10_000_000n)
console.log(
'[CONTROL] displayed total =',
paid,
'| buttons disabled =',
buttons.map((b) => (b as HTMLButtonElement).disabled).join(','),
'| insufficient-balance warnings =',
screen.getAllByText('Insufficient balance').length,
'| needsApproval =',
allowance < tokenPrice,
'| renewal approve amount =',
(tokenPrice * 2n).toString(),
)
})
it('the sibling multi-name picker blocks the same condition', async () => {
// MultiNamePaymentTokenPicker.tsx:123-137 refuses to price a batch when any
// read failed. Reproduced verbatim against the same undefined inputs.
const { isPriceResult } = await import(
'@/features/register/utils/registrationPrice'
)
const failedQueries = [{ data: undefined }, { data: undefined }]
const okQueries = [{ data: REAL_USDC_PRICE }, { data: REAL_USDC_PRICE }]
const pricesResolvedWhenFailed = failedQueries.every(
(q) => q.data && isPriceResult(q.data),
)
const pricesResolvedWhenOk = okQueries.every(
(q) => q.data && isPriceResult(q.data),
)
expect(pricesResolvedWhenFailed).toBe(false)
expect(pricesResolvedWhenOk).toBe(true)
console.log(
'[SIBLING GUARD] multi-name pricesResolved(failed reads) =',
pricesResolvedWhenFailed,
'-> selection blocked; single-name picker has no equivalent gate',
)
})
})
Command:
pnpm --filter portal exec vitest run src/portal2_zero_price_checkout.test.tsx --reporter=verbose --silent=false
Captured output:
stdout | src/portal2_zero_price_checkout.test.tsx > zero-price checkout > resultQueryOptions turns a production price Err into data === undefined
[STEP 1] query status = error | query.data = undefined
stdout | src/portal2_zero_price_checkout.test.tsx > zero-price checkout > DEFECT: undefined price -> $0.00 total, enabled button on a 0-balance wallet, no approval
[DEFECT] displayed total = $0.00 | buttons disabled = false,false | insufficient-balance warnings = 0 | needsApproval = false | renewal approve amount = 0
stdout | src/portal2_zero_price_checkout.test.tsx > zero-price checkout > CONTROL: same wallet, price reads succeed -> $5.00, disabled buttons, approval required
[CONTROL] displayed total = $5.00 | buttons disabled = true,true | insufficient-balance warnings = 2 | needsApproval = true | renewal approve amount = 10000000
stdout | src/portal2_zero_price_checkout.test.tsx > zero-price checkout > the sibling multi-name picker blocks the same condition
[SIBLING GUARD] multi-name pricesResolved(failed reads) = false -> selection blocked; single-name picker has no equivalent gate
✓ src/portal2_zero_price_checkout.test.tsx > zero-price checkout > resultQueryOptions turns a production price Err into data === undefined 7ms
✓ src/portal2_zero_price_checkout.test.tsx > zero-price checkout > DEFECT: undefined price -> $0.00 total, enabled button on a 0-balance wallet, no approval 136ms
✓ src/portal2_zero_price_checkout.test.tsx > zero-price checkout > CONTROL: same wallet, price reads succeed -> $5.00, disabled buttons, approval required 62ms
✓ src/portal2_zero_price_checkout.test.tsx > zero-price checkout > the sibling multi-name picker blocks the same condition 1ms
Test Files 1 passed (1)
Tests 4 passed (4)
Start at 22:00:30
Duration 10.93s (transform 1.37s, setup 360ms, import 9.09s, tests 210ms, environment 856ms)
The price read is a revert-prone contract call, not only an RPC risk
getRegistrationPrice and getRenewalPrice end in a contract read, and those reads carry named revert paths. Measured against a local Anvil Sepolia fork (http://127.0.0.1:8546, chain id 11155111), on the v2 ETHRegistrar 0xa88553F454b77203B0D036A05c894d555EAAa2Cc and the v1 ETHRenewerV1 0x4ad56feb5Fc7B8298db06E88fd5CBc41D64602Fa:
$ cast call $REGISTRAR 'getRegisterPrice(string,uint64,address)(uint256,uint256)' 'zzfinalizerprobe' 31536000 $USDC
8000021 [8e6] 0
$ cast call $REGISTRAR 'getRegisterPrice(string,uint64,address)(uint256,uint256)' 'nike' 31536000 $USDC
Error: execution reverted: custom error 0x477707e8: nike
$ cast call $REGISTRAR 'getRenewPrice(string,uint64,address)(uint256)' 'zzfinalizerprobe' 31536000 $USDC
Error: execution reverted: custom error 0x1caefaa0: zzfinalizerprobe
$ cast call $RENEWER 'getRenewPrice(string,uint64,address)(uint256)' 'nike' 31536000 $USDC
160000009 [1.6e8]
$ cast 4byte 0x477707e8
NameNotAvailable(string)
$ cast 4byte 0x1caefaa0
NameNotRenewable(string)
So the same call that returns 8000021 for one label reverts NameNotAvailable or NameNotRenewable for another, purely on the chain state of the label at read time. Both revert paths land in Err(GetRegistrationPriceError) and therefore in data === undefined, which is the input the defect arm above is driven with. The picker issues one price query per token (PaymentTokenPicker.tsx:92-107), so the USDC and DAI reads settle independently and either can be the one that errors while the other succeeds.
Terminal measurement: what was displayed, what was signed, what was charged
The section above stops at the render and the step list. This one carries the same checkout to its endpoint on the local Anvil Sepolia fork and measures four quantities side by side: the total the app displayed, the amount the wallet was actually asked to approve, the amount the registrar pulled, and the buyer's token balance before and after.
Both arms run the shipped containers: PaymentTokenSection, which mounts the real PaymentTokenPicker and lets it issue its own price, balance and allowance queries; the real useRegistrationTransactions; the real TransactionModal; and the real registrationMachine with every actor in packages/transaction-manager. The buyer is a real wagmi connection to a clean EOA, not a prop. The clicks are real clicks on the rendered token row, the Register button, the modal's Start button and the modal's Open wallet button. The single substituted dependency is the JSON-RPC endpoint that the app's own client accessor safeGetClient returns to the PRICE query (useRegistrationPrice.ts:51 through lib/wagmi/helpers.ts:16): in the defect arm it points at a closed port, in the control arm at the fork. Balances, allowances, the machine's publicClient and every write go to the fork in both arms.
The one thing the earlier section could not see is what the registration state machine does on its own. registration.machine.ts:1247-1300 enters checkingAllowance, reads the LIVE register price with readPaymentAuthorizationActor (registration.actors.ts:592-630), and when the allowance is short it submits an approval for that live price. registration.actors.ts:82-84 is the amount:
function authorizedPaymentAmount(price: bigint): bigint {
return price + price / 10n
}
So the wallet is prompted to approve 8800023 base units while the app's own step list, its success screen and its paid value all say $0.00, and the registrar then pulls 8000021.
Save as apps/portal/src/__poc_term3__/portal_zero_price_terminal.poc.test.tsx:
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { connect, disconnect } from '@wagmi/core'
import { mock } from '@wagmi/connectors'
import { extendChainWithEns } from '@ensdomains/ensjs/chain'
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
import {
type Address,
createPublicClient,
createWalletClient,
erc20Abi,
http,
parseAbiItem,
} from 'viem'
import { sepolia } from 'viem/chains'
import { useEffect } from 'react'
import { createConfig, usePublicClient, WagmiProvider } from 'wagmi'
import { afterEach, beforeAll, describe, expect, it, vi } from 'vitest'
const FORK = 'http://127.0.0.1:8546'
/** Closed port: the price RPC is the one dependency that fails. */
const DEAD_RPC = 'http://127.0.0.1:1'
const USDC = '0x768F42455A2D082E23ceeF7d51e5787C82d67a39' as Address
const ETH_REGISTRAR = '0xa88553F454b77203B0D036A05c894d555EAAa2Cc' as Address
/** Clean EOA (no code), funded with 100 USDC and ETH on the fork. */
const VICTIM = '0xbEeF00000000000000000000000000000000e301' as Address
const DURATION_SECONDS = 31_536_000
/**
* Ten-character labels, so both arms carry the identical registrar price, and
* freshly randomised per run, because a label registered by a previous run is
* no longer available and `getRegisterPrice` then reverts `NameNotAvailable`.
*/
const suffix = () => {
const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789'
let out = ''
for (let i = 0; i < 4; i++) {
out += alphabet[Math.floor(Math.random() * alphabet.length)]
}
return out
}
const DEFECT_LABEL = `term3z${suffix()}`
const CONTROL_LABEL = `term3c${suffix()}`
const TARGET_USDC = 100_000_000n
const forkChain = {
...extendChainWithEns(sepolia),
rpcUrls: {
default: { http: [FORK] },
public: { http: [FORK] },
},
}
const observer = createPublicClient({
chain: forkChain,
transport: http(FORK, { timeout: 120_000, retryCount: 8, retryDelay: 2_000 }),
})
// `safeGetClient` is the app's own accessor for its module-level wagmi client
// (lib/wagmi/helpers.ts:16). Only the price path uses it; balances, allowances,
// the machine's publicClient and every write go through the WagmiProvider
// config below, which points at the fork.
vi.mock('@/lib/wagmi/helpers', async () => {
const { ok } = await import('neverthrow')
return {
// biome-ignore lint/suspicious/noExplicitAny: test global
safeGetClient: () => ok((globalThis as any).__TERM3_PRICE_CLIENT__),
safeGetConnectorClient: () => {
throw new Error('not used in this PoC')
},
}
})
// Fire-and-forget Etherscan call made after the resolver proxy deploys
// (useRegistrationTransactions.ts:103). External service, no bearing on any
// asserted value.
vi.mock('@/utils/blockExplorer/verifyProxyContract', () => ({
verifyProxyContract: async () => undefined,
}))
const { TransactionManagerProvider, transactionManager } = await import(
'@ens-apps/transaction-manager'
)
const { PaymentTokenSection } = await import(
'@/features/register/components/PaymentTokenSection'
)
const { useRegistrationTransactions } = await import(
'@/features/register/hooks/useRegistrationTransactions'
)
const { TransactionModal } = await import(
'@/features/transaction-manager/components/TransactionModal'
)
const { useTransactionModal, closeTransactionModal } = await import(
'@/features/transaction-manager/hooks/useTransactionModal'
)
const { getEnsOwnerQueryOptions } = await import(
'@/features/profile/hooks/useEnsOwner'
)
const priceClientFor = (url: string) =>
createPublicClient({
chain: forkChain,
transport: http(url, {
timeout: url === FORK ? 120_000 : 2_000,
retryCount: url === FORK ? 8 : 0,
retryDelay: 2_000,
}),
})
const wagmiConfigForFork = () =>
createConfig({
chains: [forkChain],
connectors: [mock({ accounts: [VICTIM] })],
storage: null,
transports: {
[forkChain.id]: http(FORK, {
timeout: 120_000,
retryCount: 8,
retryDelay: 2_000,
}),
},
})
type Captured = {
paid: string | undefined
stepTitles: string[]
stepIds: string[]
isSuccess: boolean
confirmedPrice: bigint | null
}
const captured: Captured = {
paid: undefined,
stepTitles: [],
stepIds: [],
isSuccess: false,
confirmedPrice: null,
}
/** Mirrors __root.tsx:22-42 `TransactionManagerSetup`, minus the router-only hooks. */
const TxManagerSetup = ({ children }: { children: React.ReactNode }) => {
const publicClient = usePublicClient()
useEffect(() => {
if (publicClient) {
transactionManager.setPublicClient(forkChain.id, publicClient)
}
}, [publicClient])
if (!publicClient) return <>{children}</>
return (
<TransactionManagerProvider publicClient={publicClient}>
{children}
</TransactionManagerProvider>
)
}
/**
* Mirrors RegisterName.tsx:39, :79-81, :168-180 - the same hook, the same
* onConfirm body (startFlow then openModal), the same modal.
*/
const CheckoutHarness = ({ name }: { name: string }) => {
const { transactions, isRegistering, isSuccess, paid, startFlow } =
useRegistrationTransactions({ name, duration: DURATION_SECONDS })
const { openModal } = useTransactionModal()
captured.paid = paid
captured.stepTitles = transactions.map((t) => t.title)
captured.stepIds = transactions.map((t) => t.id)
captured.isSuccess = isSuccess
return (
<>
<PaymentTokenSection
name={name}
duration={DURATION_SECONDS}
isConnected
isRegistering={isRegistering}
onConfirm={(tokenAddress, tokenPrice) => {
captured.confirmedPrice = tokenPrice
startFlow(tokenAddress, tokenPrice)
openModal()
}}
/>
<TransactionModal transactions={transactions} />
</>
)
}
const readUsdc = async (fn: 'balanceOf' | 'allowance') =>
observer.readContract({
address: USDC,
abi: erc20Abi,
functionName: fn,
args: fn === 'balanceOf' ? [VICTIM] : [VICTIM, ETH_REGISTRAR],
// biome-ignore lint/suspicious/noExplicitAny: two arities, one call site
} as any) as Promise<bigint>
const APPROVAL_EVENT = parseAbiItem(
'event Approval(address indexed owner, address indexed spender, uint256 value)',
)
const TRANSFER_EVENT = parseAbiItem(
'event Transfer(address indexed from, address indexed to, uint256 value)',
)
const victimWallet = () =>
createWalletClient({
account: VICTIM,
chain: forkChain,
transport: http(FORK, { timeout: 120_000 }),
})
/**
* Fixture reset so both arms start from the identical wallet state: exactly
* 100.000000 USDC and a zero allowance to the registrar. Both are ordinary
* ERC-20 calls on the fork's mock token; neither touches app code.
*/
async function resetWalletFixture() {
await observer.request({
method: 'anvil_setBalance',
params: [VICTIM, '0x56BC75E2D63100000'],
// biome-ignore lint/suspicious/noExplicitAny: anvil namespace
} as any)
const wallet = victimWallet()
if ((await readUsdc('allowance')) !== 0n) {
const hash = await wallet.writeContract({
address: USDC,
abi: erc20Abi,
functionName: 'approve',
args: [ETH_REGISTRAR, 0n]
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
A failed price read leaves the query data undefined, and buildTokenData substitutes a DEFAULT_PRICE whose total is 0n, which then flows through the balance, availability and approval checks as if it were a real quote.
Impact
A user could be shown a $0.00 total and have the approval step removed, then be charged the real rent price on-chain; the report demonstrates this on a Sepolia fork, though it relies on the price read failing.
What the attacker needed
Price read for a token fails; victim completes checkout
The fix
The picker should treat a failed price read as an error and block selection, as the sibling multi-name picker already does, rather than substituting a zero price.
How it was found
- Connect a wallet and open the register page for an available .eth name.
- Make the picker's USDC and DAI price reads fail, for example with an RPC failure.
- Observe both tokens shown as available even on a zero-balance wallet.
- Select a token and click Register; the approval row disappears from the modal.
- Complete the flow; the registrar charges the real price by transferFrom.
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.
The checkout asks a blockchain node how much a name costs. If that question fails, the code quietly pretends the price is zero instead of showing an error. The screen then says the name is free and skips the step where the user approves spending their tokens, but the smart contract still takes the real amount when the purchase goes through.
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.