본문 바로가기

전체 글31

Ethernaut - 9단계 (King) // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract King { address king; uint public prize; address public owner; constructor() payable { owner = msg.sender; king = msg.sender; prize = msg.value; } receive() external payable { require(msg.value >= prize || msg.sender == owner); payable(king).transfer(msg.value); king = msg.sender; prize = msg.value; } function _king() public view re.. 2023. 11. 8.
Ethernaut - 8단계 (Vault) // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Vault { bool public locked; bytes32 private password; constructor(bytes32 _password) { locked = true; password = _password; } function unlock(bytes32 _password) public { if (password == _password) { locked = false; } } } Unlock the vault to pass the level! 위는 이더넛 8단계 문제이다. password를 맞히면 locked가 false가 되며 풀리는 문제 같다. 그래서 password를 알아.. 2023. 11. 8.
Ethernaut - 7단계 (Force) // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Force {/* MEOW ? /\_/\ / ____/ o o \ /~____ =ø= / (______)__m_m) */} Some contracts will simply not take your money ¯\_(ツ)_/¯ The goal of this level is to make the balance of the contract greater than zero. Things that might help: Fallback methods Sometimes the best way to attack a contract is with another contract. See the "?" pag.. 2023. 11. 7.
Ethernaut - 6단계 (Delegation) // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Delegate { address public owner; constructor(address _owner) { owner = _owner; } function pwn() public { owner = msg.sender; } } contract Delegation { address public owner; Delegate delegate; constructor(address _delegateAddress) { delegate = Delegate(_delegateAddress); owner = msg.sender; } fallback() external { (bool result,) = a.. 2023. 11. 7.