Skip to content
Business logic Audit finding Intermediate

The unwhitelist function of ERC20Custody cannot be invoked.

p0wd3r Follow

Originally disclosed on Code4rena

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.

https://github.com/code-423n4/2023-11-zetachain/blob/main/repos/node/zetaclient/evm_signer.go#L626-L633

// 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.

https://github.com/code-423n4/2023-11-zetachain/blob/main/repos/node/zetaclient/evm_signer.go#L257-L278

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.

https://github.com/code-423n4/2023-11-zetachain/blob/main/repos/protocol-contracts/contracts/evm/ERC20Custody.sol#L153-L156

    function unwhitelist(IERC20 asset) external onlyTSS {
        whitelisted[asset] = false;
        emit Unwhitelisted(asset);
    }

Tools Used

VScode

Recommended Mitigation Steps

Add a call to SignWhitelistTx.

lumtis (ZetaChain) confirmed

0xean (Judge) commented:

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”.


The original report as published on Code4rena, by p0wd3r. 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.

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.

More by p0wd3r

View all

3 more disclosed reports, best first.

More from ZetaChain

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.