Skip to content
Access control Audit finding Intermediate

Upgradable escrow contract

The escrow contract is upgradeable, so users must approve their NFTs to an admin-controlled contract that can be changed. An attacker who compromises the admin could upgrade the contract to transfer approved NFTs to themselves.

gzeon Follow

Originally disclosed on Code4rena

Submitted by gzeon

Upgradable escrow contract poses great risk to user who approved their NFT to the contract. Most popular token / NFT exchange do not require user to approve their asset to admin upgradable contract.

This also increases user gas usage because they would have to revoke approval when they are done with the protocol.

Proof of Concept

https://github.com/code-423n4/2022-02-foundation/blob/4d8c8931baffae31c7506872bf1100e1598f2754/contracts/FNDNFTMarket.sol

Recommended Mitigation Steps

Separate the escrow contract to make it non-upgradable with a restricted set of functionality.

NickCuso (Foundation) acknowledged and commented:

This is an interesting suggestion. I’m not sure if the recommendation really reduces the risk though. If we were to make the escrow portion immutable, the trust still depends on the upgradeable market contract to do the correct thing. If I’m understanding the suggestion correctly, the terms of the deal would still be defined in the upgradeable contract - so even with an immutable escrow manager we could theoretically upgrade the market to allow us to buy each of the NFTs for 0 ETH.


The original report as published on Code4rena, by gzeon. 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 escrow logic is part of an upgradeable contract, so the admin can change the code that controls approved NFTs.

Impact

An attacker with admin access could upgrade the contract to steal NFTs that users have approved, though the report does not demonstrate this.

What the attacker needed

User approves NFT to contract; admin key compromised or malicious

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 escrow contract holds your NFT while it is for sale. Because this contract can be upgraded by an admin, the admin could change the rules and take the NFT you approved. You have to trust the admin not to do this.

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 gzeon

View all

46 more disclosed reports, best first.

More from Foundation Exhibition, Scheduling & Early Access Solo Audit by Lambda

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.