Skip to content
Access control Audit finding Beginner

NFT owner can change token URI

The ERC721OnChain contract allows the owner of an NFT to change its token URI, which is normally set by the contract owner. An attacker who owns an NFT could spoof another NFT's data by changing the token URI to point to that other NFT's data.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

In the ERC721OnChain implementation the token owner can set the token’s URI using setTokenURI.

Usually, this is token URI points to data defining the NFT (attributes, images, etc.). It’s usually set by the contract owner. A user that owns an NFT can just spoof any other NFT data by changing the token URI to any of the other NFTs.

Recommended Mitigation Steps

Disallow the owner of an NFT to change its token URI

DimaStebaev (SKALE) disputed and commented:

Acknowledged,ERC721OnChain is a default implementation. If the token is sensitive to URI change SKALE chain owner can use another one. Not all ERC721 require that URI can’t be changed.

GalloDaSballo (judge) commented:

Because the argument for this being a setting can be made I am excluding a high severity.

However the code was brought into scope, the implementation under scrutiny does allow the owner to change the URI which is a known admin privilege.

For those reasons I believe the finding to be valid and of medium severity


The original report as published on Code4rena, by cmichel. 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 setTokenURI function does not restrict who can call it, allowing the token owner instead of only the contract owner to change the URI.

What the attacker needed

Own an NFT from the contract

The fix

The owner of an NFT should not be allowed to change its token URI.

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.

An NFT is a digital token; its token URI is a link to information like its picture and properties. Normally only the contract owner can set that link, but here the person who owns the NFT can change it, so they could make their NFT look like a different one.

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 cmichel

View all

196 more disclosed reports, best first.

More from SKALE contest

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.