Skip to content
Access control Audit finding Intermediate

wrapETH2LD permissioning is over-extended

The wrapETH2LD function allows an address approved on the wrapper contract to wrap an unwrapped domain, even though that approval should only cover already-wrapped tokens. An attacker with such approval could wrap a victim's unwrapped domain and take control of it.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52

Undesired use of ENS wrapper.

Proof of Concept

NameWrapper.sol#L219-L223

Current permissioning for wrapETH2LD allows msg.senders who are not owner to call it if they are EITHER approved for all on the ERC721 registrar or approved on the wrapper. Allowing users who are approved for the ERC721 registrar makes sense. By giving them approval, you are giving them approval to do what they wish with the token. Any other restrictions are moot regardless because they could use approval to transfer themselves the token anyways and bypass them as the new owner. The issue is allowing users who are approved for the wrapper contract to wrap the underlying domain. By giving approval to the contract the user should only be giving approval for the wrapped domains. As it is currently setup, once a user has given approval on the wrapper contract they have essentially given approval for every domain, wrapped or unwrapped, because any unwrapped domain can be wrapped and taken control of. This is an over-extension of approval which should be limited to the tokens managed by the wrapper contract and not extend to unwrapped domains

Recommended Mitigation Steps

Remove L221.

Arachnid (ENS) disagreed with severity and commented:

This was by design, but the warden raises a good point about the implications of this permission model. Recommend downgrading to QA.

LSDan (judge) decreased severity to Medium and commented:

I’m going to downgrade this to medium. There are not assets at direct risk, but with external factors the assets could be at risk due to the user being unaware that in approving wrapped domains, they are also approving unwrapped domains.


The original report as published on Code4rena, by 0x52. 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

The permission check for wrapETH2LD allows callers approved on the wrapper contract to wrap any unwrapped domain, extending approval beyond the wrapped tokens the wrapper manages.

Impact

An attacker with approval on the wrapper contract could wrap a victim's unwrapped domain and take control of it, though the report notes no assets are at direct risk without external factors.

What the attacker needed

Victim has approved attacker on wrapper contract; victim owns an unwrapped domain

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.

When you approve someone to manage your tokens, you expect that approval to be limited to certain tokens. Here, approving someone on the wrapper contract also let them wrap your unwrapped domains, which effectively gave them control over those domains too. This is a problem because the approval was not meant to cover unwrapped domains.

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 0x52

View all

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