-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Description
🎉 Description
Dangerous ERC827 implementation about anythingAndCall
.
Users are allowed to pass arbitrary data, leading to call any function with any data on any contract address.
- 🐛 This is a bug report.
- 📈 This is a feature request.
💻 Environment
Any contract using this ERC827 implementation or with similar CUSTOM_CALL feature will be affected.
📝 Details
It is a really bad practice to allow the abuse of CUSTOM_CALL in token standard.
<address>.call.value(msg.value)(_data)
Attackers could call any contract in the name of vulnerable contract with CUSTOM_CALL.
This vulnerability will make these attacking scenarios possible:
-
Attackers could steal almost each kind of tokens belong to the vulnerable contract [1] [2]
-
Attackers could steal almost each kind of tokens
approved
to the vulnerable contract -
Attackers could bypass the auth check in vulnerable contract by proxy of contract itself in special situation [3] (edit: current openzeppelin implementation is not affected with the help of
require(_to != address(this));
) -
Attackers could pass fake values as parameter to cheat with receiver contract [4]
We (SECBIT) think that the ERC827 proposal should be discussed further in community before OpenZeppelin putting the implementation in the repo. Many developers could use this code without knowledge of hidden danger.
[1] attack 1, https://etherscan.io/tx/0xb72dcc4d04381ccad416b960e95183e94ee13e942743da913cf139c8abe212e7
[2] attack 2, https://etherscan.io/tx/0x40a292d74bddaac2690385aee0c366edf31904ef681b547b1baa3190ba568888
[3] custom_call related bug, https://medium.com/@atnio/erc223-smart-contract-breach-and-resolution-vulnerability-relating-to-the-concurrent-9a402495f382
[4] pass fake values to receiver contract, ethereum/EIPs#827 (comment)