code4rena-2023-12-shell-protocol-l01

[L-01] 2 address tokens will not work properly on the Ocean ERC1155 Ledger

보고서

Summary

다중 주소를 이용하는 특이한 ERC20이 있다. 이들은 별개의 OceanId 로 계산되므로, 동일 토큰임에도 별도의 원장을 갖게 된다.

Keyword

erc20, integration

Vulnerability

Synthetix 의 ProxyERC20 와 같이 엔트리포인트가 여러개인 특이한 ERC20에 대한 원장이 제대로 작동하지 않을 수 있다. 이러한 토큰을 이중 진입 토큰, 또는 두 개의 주소 토큰(double entry tokens/two address tokens)이라고 한다.

모든 토큰이 _getSpecifiedToken 를 호출하여 _calculateOceanId 로 각자 ID를 가진다. 단순히 주소를 해시하므로 이중 진입 토큰은 동일 토큰이 아닌 2개의 별도의 원장을 생성하게 된다.

   function _calculateOceanId(address tokenAddress, uint256 tokenId) internal pure returns (uint256) {
        return uint256(keccak256(abi.encodePacked(tokenAddress, tokenId)));
    }

Impact

특이한 ERC20의 지원이 되지 않는다.

Mitigation

이에 대해 고려하거나 특이한 토큰은 시스템에서 사용하지 않도록 한다.


tags: bughunting, shell protocol, smart contract, solidity, erc20, integration, severity low