慢雾:分析Poly Network遭受攻击细节,并非keeper私钥泄露导致

This article is not available in the current language yet. Showing the original version.
慢雾安全团队认为,攻击者通过此函数传入精心构造的数据修改了 EthCrossChainData 合约的 keeper 为攻击者指定的地址,并非网传的是由于 keeper 私钥泄漏导致这一事件的发生。

跨链互操作协议 Poly Network 遭受黑客攻击引发关注,官方转载了慢雾安全团队的分析,慢雾安全团队认为,攻击者通过此函数传入精心构造的数据修改了 EthCrossChainData 合约的 keeper 为攻击者指定的地址,并非网传的是由于 keeper 私钥泄漏导致这一事件的发生。 

攻击细节 

1. 本次攻击的核心在于 EthCrossChainManager 合约的 verifyHeaderAndExecuteTx 函数可以通过 _executeCrossChainTx 函数执行具体的跨链交易。

2. 由于 EthCrossChainData 合约的 owner 为 EthCrossChainManager 合约,因此 EthCrossChainManager 合约可以通过调用 EthCrossChainData 合约的 putCurEpochConPubKeyBytes 函数修改合约的 keeper。 

3. 其中 EthCrossChainManager 合约的 verifyHeaderAndExecuteTx 函数是可以通过内部调用 _executeCrossChainTx 函数执行用户指定的跨链交易,所以攻击者只需要通过 verifyHeaderAndExecuteTx 函数传入精心构造的数据来使 _executeCrossChainTx 函数执行调用 EthCrossChainData 合约的 putCurEpochConPubKeyBytes 函数以改变 keeper 角色为攻击者指定的地址。  

4. 替换完成 keeper 角色地址后,攻击者即可随意构造交易从合约中取出任意数量的资金了。   

攻击流程 

1. 被攻击合约: https://bscscan.com/address/0x7cea671dabfba880af6723bddd6b9f4caa15c87b  

2. 攻击者通过 EthCrossChainManager 合约的 verifyHeaderAndExecuteTx 函数调用 putCurEpochConPubKeyBytes 函数更改 keeper 操作: https://bscscan.com/tx/0x3eba3f1fb50c4cbe76e7cc4dcc14ac7544762a0e785cf22034f175f67c8d3be9  

3. 攻击者实施攻击: https://bscscan.com/tx/0x534966864bda354628d4f1c66db45cbefcdda7433e9576e7664fea01bb05be9a https://bscscan.com/tx/0xd59223a8cd2406cfd0563b16e06482b9a3efecfd896d590a3dba1042697de11a https://bscscan.com/tx/0x4e57f59395aca4847c4d001db4a980b92aab7676bc0e2d57ee39e83502527d6c https://bscscan.com/tx/0x50105b6d07b4d738cd11b4b8ae16943bed09c7ce724dc8b171c74155dd496c25 https://bscscan.com/tx/0xd65025a2dd953f529815bd3c669ada635c6001b3cc50e042f9477c7db077b4c9 https://bscscan.com/tx/0xea37b320843f75a8a849fdf13cd357cb64761a848d48a516c3cac5bbd6caaad5   

4. 攻击完成后,由于 keeper 被修改,导致其他用的正常交易被 revert。 



5. 同理以太坊上也是类似的操作: 

被攻击合约: https://etherscan.io/address/0x838bf9e95cb12dd76a54c9f9d2e3082eaf928270 

攻击者更改 keeper 操作: https://etherscan.io/tx/0xb1f70464bd95b774c6ce60fc706eb5f9e35cb5f06e6cfe7c17dcda46ffd59581 

攻击者实施攻击交易: https://etherscan.io/tx/0xad7a2c70c958fcd3effbf374d0acf3774a9257577625ae4c838e24b0de17602a  

总结 

本次攻击主要在于 EthCrossChainData 合约的 keeper 可由 EthCrossChainManager 合约进行修改,而 EthCrossChainManager 合约的 verifyHeaderAndExecuteTx 函数又可以通过 _executeCrossChainTx 函数执行用户传入的数据。因此攻击者通过此函数传入精心构造的数据修改了 EthCrossChainData 合约的 keeper 为攻击者指定的地址,并非网传的是由于 keeper 私钥泄漏导致这一事件的发生。 

Share to:

Author: PANews官方

Opinions belong to the column author and do not represent PANews.

This content is not investment advice.

Image source: PANews官方. If there is any infringement, please contact the author for removal.

Follow PANews official accounts, navigate bull and bear markets together
PANews APP
Gate will launch spot and instant trading of Unitas (UNITAS).
PANews Newsflash