Submitted by Trust
ERC721H.sol#L185
ERC721H.sol#L121
ERC20H and ERC721H are base contracts for NFTs / coins to inherit from. They supply the modifier onlyOwner and function isOwner which are used in the implementations for access control. However, there are several functions which when using these the answer may be corrupted to true by an attacker.
The issue comes from confusion between calls coming from HolographERC721s fallback function, and calls from actually implemented functions.
In the fallback function, the enforcer appends an additional 32 bytes of msg.sender:
Indeed these are the bytes read as msgSender:
and isOwner simply compares these to the stored owner:
However, the enforcer calls these functions directly in several locations, and in these cases it of course does not append a 32 byte msg.sender. For example, in safeTransferFrom:
Here, caller has arbitrary control of the data parameter, and can pass owners address.When the implementation, SourceERC721(), gets called, beforeSafeTransfer / afterSafeTransfer will behave as if they are called by owner.
Therefore, depending on the actual implementation, derived contracts can lose funds by specifying owner-specific logic.
This pattern occurs with the following functions, which have an arbitrary data parameter:
Owner-specific functionality can be initiated on NFT / ERC20 implementation contracts.
Refactor the code to represent msg.sender information in a bug-free way.
gzeon (judge) commented:
Trust (warden) commented:
gzeon (judge) commented:
Trust (warden) commented:
gzeon (judge) commented:
Also they cant manipulate unless it is called from the Holographer, which have limited affordance.
alexanderattar (Holograph) confirmed and commented:
ACC01ADE (Holograph) commented:
