HolographERC20 breaks composability by forcing usage of draft proposal EIP-4524
The HolographERC20 enforcer required any contract recipient of a safeTransferFrom to implement the draft EIP-4524 receiver interface, reverting otherwise. This made tokens issued through the enforcer unusable with most DeFi contracts that do not support that draft standard.
Submitted by Trust
HolographERC20 is the ERC20 enforcer for Holograph. In the safeTransferFrom operation, it calls _checkOnERC20Received:
if (_isEventRegistered(HolographERC20Event.beforeSafeTransfer)) {
require(SourceERC20().beforeSafeTransfer(account, recipient, amount, data));
}
_transfer(account, recipient, amount);
require(_checkOnERC20Received(account, recipient, amount, data), "ERC20: non ERC20Receiver");
if (_isEventRegistered(HolographERC20Event.afterSafeTransfer)) {
require(SourceERC20().afterSafeTransfer(account, recipient, amount, data));
}
The checkOnERC20Received function:
if (_isContract(recipient)) {
try ERC165(recipient).supportsInterface(ERC165.supportsInterface.selector) returns (bool erc165support) {
require(erc165support, "ERC20: no ERC165 support");
// we have erc165 support
if (ERC165(recipient).supportsInterface(0x534f5876)) {
// we have eip-4524 support
try ERC20Receiver(recipient).onERC20Received(address(this), account, amount, data) returns (bytes4 retv
return retval == ERC20Receiver.onERC20Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC20: non ERC20Receiver");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
revert("ERC20: eip-4524 not supported");
}
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC20: no ERC165 support");
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
} else {
return true;
}
In essence, if the target is a contract, the enforcer requires it to fully implement EIP-4524. The problem is that this EIP is just a draft proposal, which the project cannot assume to be supported by any receiver contract, and definitely not every receiver contract.
The specs warn us:
⚠️ This EIP is not recommended for general use or implementation as it is likely to change.
Therefore, it is a very dangerous requirement to add in an ERC20 enforcer, and must be left to the implementation to do if it so desires.
Impact
ERC20s enforced by HolographERC20 are completely uncomposable. They cannot be used for almost any DeFi application, making it basically useless.
Recommended Mitigation Steps
Remove the EIP-4524 requirements altogether.
Low risk unless this is not a design decision.
alexanderattar (Holograph) confirmed and commented:
Originally a design choice, but it can be updated to not revert if the EIP is not supported.
Will argue that philosophically any code is originally a design choice. If it’s later made clear the choice has unintended dire consequences then the finding should not be penalized because of that alone.
ACC01ADE (Holograph) linked a PR:
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 enforcer hard-coded a requirement that contract recipients support a draft EIP-4524 interface instead of leaving that choice to the token implementation.
Impact
Tokens enforced by HolographERC20 could not be sent to contracts that lack EIP-4524 support, so they were effectively unusable in most DeFi applications; the judge rated this low risk unless it was not a design decision.
What the attacker needed
Token issued via HolographERC20; recipient is a contract without EIP-4524
The fix
The project said it could be updated so the transfer does not revert when the EIP is not supported, and a fix PR was linked.
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 send a token to a smart contract, the token contract often checks that the receiver knows how to handle tokens, so they are not lost. Here the check demanded a specific draft standard that almost no contract implements, so transfers to most contracts failed. That means the token could not be used in lending, trading or other DeFi apps.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.