Web3/The Ethernaut

// SPDX-License-Identifier: MITpragma solidity ^0.8.0;interface Building { function isLastFloor(uint256) external returns (bool);}contract Elevator { bool public top; uint256 public floor; function goTo(uint256 _floor) public { Building building = Building(msg.sender); if (!building.isLastFloor(_floor)) { floor = _floor; top = building.isLastFloor(..
아 Foundry 코드짜는거가 익숙치가 않아서 너무 시간을 많이 잡아 먹었다.// SPDX-License-Identifier: MITpragma solidity ^0.6.12;import "openzeppelin-contracts-06/math/SafeMath.sol";contract Reentrance { using SafeMath for uint256; mapping(address => uint256) public balances; function donate(address _to) public payable { balances[_to] = balances[_to].add(msg.value); } function balanceOf(address _who) pub..
문제 설명이 영어로되어있기도 하고 뭐라는지 모르겠어서 푸는데 애먹었다;; 대충 설명하자면 king을 빼앗는게 목표인데 instance 제출할때 다시 문제에서 king을 탈취할려고 시도할 것이다.이거를 방해하기 까지 하면 성공이다.// SPDX-License-Identifier: MITpragma solidity ^0.8.0;contract King { address king; uint256 public prize; address public owner; constructor() payable { owner = msg.sender; king = msg.sender; prize = msg.value; } receive() external ..
// SPDX-License-Identifier: MITpragma 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; } }}password를 알아내면 되는 문제이다.password가 private이여서 일반적인 접근은 안된다.다만..
// SPDX-License-Identifier: MITpragma solidity ^0.8.0;contract Force { /* MEOW ? /\_/\ / ____/ o o \ /~____ =ø= / (______)__m_m) */ }컨트랙트 하나가 내용도 없이 선언되어 있다.문제는 이 컨트랙트에 잔고를 0보다 크게 만들라는 것이다.해당 컨트랙트에는 fallback함수도 없고 이더를 받는 함수도 없으므로 표면적으로는 불가능해 보인다. 하지만 Solidity에는 selfdestruct라는 얘가 있다.selfdestruct란 아래 공식문서에 나와있듯이 자신의 contract를 파괴하면서 잔고를 target..
프레딕
'Web3/The Ethernaut' 카테고리의 글 목록 (3 Page)