

const start = async () => {
if(window.ethereum !== "undefined") {
const accounts = await ethereum.request({method: "eth_requestAccounts"});
account = accounts[0];
console.log(`my contract: ${account}`);
}
const ABI = [
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
}
],
"name": "changeOwner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "opensafe",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
];
const ADDRESS = "0x5e992854Bd912ae170b7b5b8a64323e4e5E0feAF";
window.web3 = await new Web3(window.ethereum);
window.contract = new web3.eth.Contract(ABI, ADDRESS);
console.log(`safe contract: ${window.contract.options.address}`);
}
start();
async function openSafe() {
try {
const result = await window.contract.methods.opensafe().call({from: account});
if (result === "Your not owner!!") {
document.getElementById('result').innerText = result;
} else {
document.getElementById('result').innerText = result;
var door = document.getElementById('door');
door.style.transform = 'rotateY(-90deg)';
}
} catch (error) {
console.error(error);
}
}
-> 위의코드는 개발자 도구로 열어서 확인해본 코드이다. 여기서 더 힌트를 얻지는 못 할 것 같아 문제 파일을 확인해본다.
safe.sol이라는 파일만 있다.

코드를 확인해보면 owner 는 msg.sender여야만 금고가 열리는 것 같다.


그러면 이제 owner == msg.sender이므로 owner의 주소를 알아내고 그 주소를 opensafe()함수를 사용하여 열면 열리겠다.



'swuforce' 카테고리의 다른 글
| [CPPG] 자격증 공부 - 문제 (~ 개인정보보호 관련 법률 체계) (0) | 2025.10.01 |
|---|---|
| [워게임 공부]BISC safe (0) | 2025.09.30 |
| [기술스터디]암호화 그 이상의 위협, DireWolf는 왜 위험한가 (0) | 2025.09.30 |
| [워게임] baby-union (0) | 2025.09.23 |
| [기술스터디] Story of H2 2023: A Deep Dive into Data Leakage and Commerce in Chinese Telegram Channels (1) | 2025.09.23 |