워게임

ICEWALL web-hacking 스터디반 과제 정리 1

sewoo-jjang 2025. 12. 30. 18:46

과제에 앞서 tryhackme의 문제를 풀기 위해서는 open vpn을 실행해야함.
Open VPN

 

TryHackMe | Cyber Security Training

TryHackMe is a free online platform for learning cyber security, using hands-on exercises and labs, all through your browser!

tryhackme.com

 

과제 1: tryhackme에서 가장 쉬운 방

Offensive Security Intro

 

Offensive Security Intro

Hack your first website (legally in a safe environment) and experience an ethical hacker's job.

tryhackme.com

1. 머신을 시작하면 화면에 스플릿뷰로 VM이 실행됨

 

 

2. 좌측에 나와있는 설명을 따라 취약한 웹 페이지로 이동

 

3. 숨어있는 도메인 찾기

왼쪽 설명에 나와있는대로

gobuster -u http://fakebank.thm -w wordlist.txt dir

를 입력하여 추가적으로 들어갈 수 있는 웹 페이지가 있는지 검색

# 여기서 Gobuster 명령어란 웹 서버나 서비스에서 숨겨진 경로·파일·서브도메인을 워드리스트로 빠르게 찾아주는 브루트포싱 도구임

 

4. gobuster로 찾아낸 /bank-transfer 주소로 이동

다른 계좌에서 원하는 계좌로 돈을 송금할 수 있는 페이지임을 확인할 수 있다.

 

5. 문제에 나와있는대로 2276계좌에서 8881계좌로 $2000를 송금하면 문제 해결

회색 박스 안에 있는 BANK-HACKED를 입력하면 끝

과제 2: 간단한 쿠키 취약점을 이용한 워게임

cookie

 

로그인 | Dreamhack

 

dreamhack.io

 

1. 소스코드 확인

#!/usr/bin/python3
from flask import Flask, request, render_template, make_response, redirect, url_for

app = Flask(__name__)

try:
    FLAG = open('./flag.txt', 'r').read()
except:
    FLAG = '[**FLAG**]'

users = {
    'guest': 'guest',
    'admin': FLAG
}

@app.route('/')
def index():
    username = request.cookies.get('username', None)
    if username:
        return render_template('index.html', text=f'Hello {username}, {"flag is " + FLAG if username == "admin" else "you are not admin"}')
    return render_template('index.html')

@app.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'GET':
        return render_template('login.html')
    elif request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')
        try:
            pw = users[username]
        except:
            return '<script>alert("not found user");history.go(-1);</script>'
        if pw == password:
            resp = make_response(redirect(url_for('index')) )
            resp.set_cookie('username', username)
            return resp 
        return '<script>alert("wrong password");history.go(-1);</script>'

app.run(host='0.0.0.0', port=8000)
  • 소스코드를 살펴보면
    • return render_template('index.html', text=f'Hello {username}, {"flag is " + FLAG if username == "admin" else "you are not admin"}')
    • 이 줄에서 username이 "admin"이면 FLAG가 나오는걸 확인할 수 있다.

 

  • 또한 username은
    • resp.set_cookie('username', username)
    • 이 부분에서 'username'이라는 쿠키로 설정되는걸 확인할 수 있다.

 

2. payload 입력

웹 페이지에 들어가 f12를 눌러 개발자 모드를 활성화 한다.

application에 있는 cookies 목록에 Name이 username이고 Value가 admin인 cookie를 하나 만들어주면 해당 쿠키를 받아와 admin 계정으로 로그인 할 수 있을것이다.

3. 실행

다음과같이 정상적으로 flag가 생성되는것을 확인할 수 있다.

 

 

'워게임' 카테고리의 다른 글

[시스템 해킹] bof1 write-up  (0) 2026.01.16
math.c write-up  (0) 2026.01.16
ICEWALL web-hacking 스터디반 과제 정리 3  (0) 2026.01.04
[웹 해킹] xss-1 write-up  (0) 2026.01.03
ICEWALL web-hacking 스터디반 과제 정리 2  (0) 2025.12.31