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.
Submitted by panprog
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:
- Alice registers and wraps
test.ethdomain - Alice creates subdomain
bob.test.ethand burnsPARENT_CANNOT_CONTROLfuse with max expiry, transferring this domain to Bob - At this point Bob can verify that he is indeed domain owner of
bob.test.ethinNameWrapper,PARENT_CANNOT_CONTROLfuse is burnt for this domain and fuse expiry is set to expiry oftest.ethdomain. So Bob thinks his domain is secure and can not be taken from him before the expiry. - Bob unwraps
bob.test.ethdomain. - Bob wraps
bob.test.ethdomain, which clears fuses and expiry - Alice changes
bob.test.ethdomain 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);
}
A mitigation step for this could be to not burn fuses when unwrapping domains to prevent the
PARENT_CANNOT_CONTROLfrom 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.
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
- Alice registers and wraps test.eth domain.
- Alice creates subdomain bob.test.eth and burns PARENT_CANNOT_CONTROL fuse with max expiry, transferring to Bob.
- Bob unwraps bob.test.eth domain.
- Bob wraps bob.test.eth domain, which clears fuses and expiry.
- 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.