Skip to content
Business logic Audit finding Advanced

If PARENT_CANNOT_CONTROL is set on subdomain, it can be unwrapped then wrapped by its owner and then parent can control it again before the expiry

The NameWrapper contract allowed burning the PARENT_CANNOT_CONTROL fuse without also burning CANNOT_UNWRAP, so a subdomain owner could unwrap and rewrap the name, clearing the fuse and letting the parent regain control before expiry. An attacker who is the parent could then change ownership of the subdomain, breaking the owner's expectation of security until expiry.

panprog Follow

Originally disclosed on Code4rena

Submitted by panprog

NameWrapper.sol#L955-L961

There is a general incorrect logic of allowing to burn only PARENT_CANNOT_CONTROL fuse without burning CANNOT_UNWRAP fuse. If only PARENT_CANNOT_CONTROL fuse is burnt, then domain can be unwrapped by its owner and then wrapped again, which clears PARENT_CANNOT_CONTROL fuse, making it possible for parent to bypass the limitation of parent control before the expiry.

Bypassing parent control scenario:

  1. Alice registers and wraps test.eth domain
  2. Alice creates subdomain bob.test.eth and burns PARENT_CANNOT_CONTROL fuse with max expiry, transferring this domain to Bob
  3. At this point Bob can verify that he is indeed domain owner of bob.test.eth in NameWrapper, PARENT_CANNOT_CONTROL fuse is burnt for this domain and fuse expiry is set to expiry of test.eth domain. So Bob thinks his domain is secure and can not be taken from him before the expiry.
  4. Bob unwraps bob.test.eth domain.
  5. Bob wraps bob.test.eth domain, which clears fuses and expiry
  6. Alice changes bob.test.eth domain ownership to her breaking Bob’s impression that his domain was secure until expiry.

Proof of Concept

Copy this to test/wrapper and run: yarn test test/wrapper/NameWrapperBypassPCC.js

https://gist.github.com/panprog/71dea0fd1875b4d7d5849f7da822ea8b

Recommended Mitigation Steps

Burning any fuse (including PARENT_CANNOT_CONTROL) must require CANNOT_UNWRAP fuse to be burned (because otherwise it’s possible to unwrap+wrap to clear that fuse).

In NameWrapper._canFusesBeBurned, condition should be different:

    if (
        fuses & ~CANNOT_UNWRAP != 0 &&
        fuses & (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP) !=
        (PARENT_CANNOT_CONTROL | CANNOT_UNWRAP)
    ) {
        revert OperationProhibited(node);
    }

jefflau (ENS) commented:

A mitigation step for this could be to not burn fuses when unwrapping domains to prevent the PARENT_CANNOT_CONTROL from being reset.

Arachnid (ENS) disagreed with severity and commented:

Since this has to be self-inflicted by the victim, this should be severity 2.

LSDan (judge) decreased severity to Medium and commented:

Agree with the sponsor that this is a medium severity issue due to the external requirement that Bob unwraps and rewraps the domain. Additionally, this requires Alice to all of a sudden become a bad actor, making it highly unlikely that this would occur.


The original report as published on Code4rena, by panprog. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 contract allowed burning PARENT_CANNOT_CONTROL without requiring CANNOT_UNWRAP, so unwrapping and rewrapping cleared the fuse.

Impact

The parent could regain control of the subdomain before the intended expiry, but only if the subdomain owner first unwraps and rewraps the name, and the parent then acts maliciously.

What the attacker needed

Victim owns a subdomain with PARENT_CANNOT_CONTROL burned; victim unwraps and rewraps the subdomain; parent becomes malicious

The fix

Burning any fuse, including PARENT_CANNOT_CONTROL, should require the CANNOT_UNWRAP fuse to be burned, or fuses should not be burned when unwrapping domains.

How it was found

  1. Alice registers and wraps test.eth domain.
  2. Alice creates subdomain bob.test.eth and burns PARENT_CANNOT_CONTROL fuse with max expiry, transferring to Bob.
  3. Bob unwraps bob.test.eth domain.
  4. Bob wraps bob.test.eth domain, which clears fuses and expiry.
  5. Alice changes bob.test.eth domain ownership to her.

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.

This is about ENS, a naming system on Ethereum. A parent domain can give a subdomain to someone and promise not to take it back until a certain date by 'burning' a setting called PARENT_CANNOT_CONTROL. The bug is that the subdomain owner could remove and re-add the subdomain, which reset that setting, so the parent could take it back early.

What is Business logic?

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

More by panprog

View all

66 more disclosed reports, best first.

More from ENS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

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