The unwhitelist function of ERC20Custody cannot be invoked.
Submitted by p0wd3r
The unwhitelist function of ERC20Custody cannot be invoked,
Proof of Concept
The unwhitelist function of ERC20Custody is supposed to be triggered by SignWhitelistTx, but SignWhitelistTx is not called anywhere else. Additionally, there is no test code in node specifically for unwhitelist.
// SignWhitelistTx
// function whitelist(
// address asset,
// ) external onlyTssAddress
// function unwhitelist(
// address asset,
// ) external onlyTssAddress
func (signer *EVMSigner) SignWhitelistTx(
# pwd node/zetaclient
grep -ri 'SignWhitelistTx' *.go
evm_signer.go:// SignWhitelistTx
evm_signer.go:func (signer *EVMSigner) SignWhitelistTx(
grep -ri 'unwhitelist' *.go
evm_signer.go:// function unwhitelist(
The whitelist function is actually called in SignCommandTx, but there is no call to unwhitelist within SignCommandTx.
func (signer *EVMSigner) SignCommandTx(
cmd string,
params string,
to ethcommon.Address,
outboundParams *types.OutboundTxParams,
gasLimit uint64,
gasPrice *big.Int,
height uint64,
) (*ethtypes.Transaction, error) {
if cmd == common.CmdWhitelistERC20 {
erc20 := ethcommon.HexToAddress(params)
if erc20 == (ethcommon.Address{}) {
return nil, fmt.Errorf("SignCommandTx: invalid erc20 address %s", params)
}
custodyAbi, err := erc20custody.ERC20CustodyMetaData.GetAbi()
if err != nil {
return nil, err
}
data, err := custodyAbi.Pack("whitelist", erc20)
if err != nil {
return nil, err
}
Ultimately, unwhitelist cannot be invoked through tss.
function unwhitelist(IERC20 asset) external onlyTSS {
whitelisted[asset] = false;
emit Unwhitelisted(asset);
}
Tools Used
VScode
Recommended Mitigation Steps
Add a call to SignWhitelistTx.
but the function of the protocol or its availability could be impacted
The impact here doesn’t necessarily mean the M severity is warranted, however I think it does impact the “function of the protocol”.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A medium-severity business logic bug in ZetaChain. Code4rena made it public on 6 September 2024. Found in the 2023-11-zetachain audit contest (finding M-30).
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.