Source contract can steal NFTs from users
The Holographed ERC721 contract gives the user-created source contract the power to burn and transfer any user's NFT without their approval. An attacker who controls or compromises the source contract owner's key could therefore steal or destroy users' NFTs.
Submitted by Jeiwan, also found by 141345 and m9800
A source contract can burn and transfer NFTs of users without their permission.
Proof of Concept
Every Holographed ERC721 collection is paired with a source contract, which is the user created contract that’s extended by the Holographed ERC721 contract (HolographFactory.sol#L234-L246). A source contract, however, has excessive privileges in the Holographed ERC721. Specifically, it can burn and transfer users’ NFTs without their approval (HolographERC721.sol#L500, HolographERC721.sol#L577):
function sourceBurn(uint256 tokenId) external onlySource {
address wallet = _tokenOwner[tokenId];
_burn(wallet, tokenId);
}
function sourceTransfer(address to, uint256 tokenId) external onlySource {
address wallet = _tokenOwner[tokenId];
_transferFrom(wallet, to, tokenId);
}
While this might be desirable for extensibility and flexibility, this puts users at the risk of being robbed by the source contract owner or a hacker who hacked the source contract owner’s key.
Recommended Mitigation Steps
Consider removing the sourceBurn and sourceTransfer functions of HolographERC721 and requiring user approval to transfer or burn their tokens (burn and safeTransferFrom can be called by a source contract instead of sourceBurn and sourceTransfer).
gzeon (judge) decreased severity to Medium and commented:
Also
#403brought up that source contract can also steal NFTs from burn address.
alexanderattar (Holograph) confirmed and commented:
Need to add a
require(!_burnedTokens[tokenId], "ERC721: token has been burned");check to sourceTransfer function
alexanderattar (Holograph) resolved:
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 Holographed ERC721 contract exposes privileged sourceBurn and sourceTransfer functions that act on any token without checking the owner's approval.
Impact
A source contract owner, or someone who compromises that owner's key, could burn or transfer users' NFTs without consent; the judge rated this Medium severity.
What the attacker needed
Control of a source contract; or compromise of its owner's key
The fix
The project resolved the issue by implementing critical fixes, including adding a check to sourceTransfer that the token has not already been burned.
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 that records who owns it. In this system, each collection has a helper contract (the source contract) that is allowed to move or destroy tokens. The bug is that this helper can do so without the owner's permission, so whoever controls the helper can take or destroy tokens.
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.