[dreamhack] BISC-SAFE

5q1·2025년 2월 25일

// SPDX-License-Identifier: MIT
pragma solidity >= 0.7.0 < 0.9.0;

contract Safe {
    address public owner;
    string private flag =  "bisc2023{FAKE_FLAG}";

    constructor() {
        owner = msg.sender;
    }

    function opensafe() public view returns (string memory) {
        if(owner == msg.sender){
            return flag;
        }
        else {
            return "Your not owner!!";
        }
    }

    function changeOwner(address _owner) public {
        require(owner == msg.sender, "Your not owner!!");
        owner = _owner;
    }
}

내 지갑의 주소와 Owner 지갑의 주소가 동일하면 풀리는 문제...
그럼 이 주소를 어떻게 불러오는 지 확인해보자

await window.contract.methods.opensafe().call({from: account});

를 통해 주소를 불러오고 있음을 확인하였고, owner의 주소의 경우, window.contract.methods.owner().call()을 통해 불러올 수 있었다.

owner불러오고,, 그거 대입하면 끝

profile
+82 02 web vulnerability tester

0개의 댓글