# 智能合约黑客攻击 Ethernaut: 6. Delegate **Published by:** [Leek DEV](https://paragraph.com/@leekdev/) **Published on:** 2023-09-26 **URL:** https://paragraph.com/@leekdev/ethernaut-6-delegate ## Content Ethernaut 是一个由 OpenZeppelin 基于 Solidity 编程语言开发的对抗游戏,每个关卡都有需要被 Hack 的智能合约。教程GitHub - 攻击代码Bilibili - 视频教程YouTube - 视频教程TikTok - ….题目将 Delegation 合约中的owner改为自己。Hack思路Delegation 可以委托调用 Delegate, 其中owner变量在同一个slot, 只要改 Delegate.owner , Delegation.owner 也会修改,调用时利用 fallback 这个方法不存在的默认hook来触发。 使用时要用 Delegate 的ABI来包装下 Delegation 的地址。 代码参考:Delegate(address(Delegation(payable(levelAddress)))).pwn(); Hack案例…防范思路….参考资料The Parity Wallet Hack Explained ## Publication Information - [Leek DEV](https://paragraph.com/@leekdev/): Publication homepage - [All Posts](https://paragraph.com/@leekdev/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@leekdev): Subscribe to updates - [Twitter](https://twitter.com/LeekDEV): Follow on Twitter