728x90
SMALL

https://xss-game.appspot.com/level1

 

XSS game: Level 1

 

xss-game.appspot.com

⬆️ 문제 사이트 입니다.

#LEVEL1

#LEVEL2

#LEVEL3

#LEVEL4

#LEVEL5

#LEVEL6

#Success!!!

LIST
728x90
SMALL

Dreamhack의 session-basic문제입니다. 쿠키와 세션으로 인증 상태를 관리하는 간단한 로그인 서비스입니다. admin 계정으로 로그인에 성공하면 플래그를 획득할 수 있습니다.

#!/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',
    'user': 'user1234',
    'admin': FLAG
}


# this is our session storage 
session_storage = {
}


@app.route('/')
def index():
    session_id = request.cookies.get('sessionid', None)
    try:
        # get username from session_storage 
        username = session_storage[session_id]
    except KeyError:
        return render_template('index.html')

    return render_template('index.html', text=f'Hello {username}, {"flag is " + FLAG if username == "admin" else "you are not admin"}')


@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:
            # you cannot know admin's pw 
            pw = users[username]
        except:
            return '<script>alert("not found user");history.go(-1);</script>'
        if pw == password:
            resp = make_response(redirect(url_for('index')) )
            session_id = os.urandom(32).hex()
            session_storage[session_id] = username
            resp.set_cookie('sessionid', session_id)
            return resp 
        return '<script>alert("wrong password");history.go(-1);</script>'


@app.route('/admin')
def admin():
    # what is it? Does this page tell you session? 
    # It is weird... TODO: the developer should add a routine for checking privilege 
    return session_storage


if __name__ == '__main__':
    import os
    # create admin sessionid and save it to our storage
    # and also you cannot reveal admin's sesseionid by brute forcing!!! haha
    session_storage[os.urandom(32).hex()] = 'admin'
    print(session_storage)
    app.run(host='0.0.0.0', port=8000)

문제 파일입니다.  /admin으로 접근이 가능한 것을 알수있습니다.

admin계정의 sesssionid 값을 이 페이지에서 확인할 수 있었습니다.

guest 계정으로 로그인후, EditThisCookie에서 username을 admin으로 설정해줬습니다.

이우 /admin 에서 확인했던 값을 sessionid에 넣어줬습니다.

위와 같이 flag를 확인할 수 있었습니다. 

LIST

'WarGame > Dreamhack' 카테고리의 다른 글

[Dreamhack|Web] Cookie  (0) 2022.05.03
728x90
SMALL

Dreamhack의 Cookie문제입니다. 이 문제는 admin계정으로 로그인을 하여 플레그를 획득할 수 있습니다. 문제에서는 쿠키로 인증 상태를 관리하는 로그인 서비스라는 것을 알려줬습니다.

#!/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)

⬆️문제 파일

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

admin으로 로그인 시 flag를 획득할 수 있다는 것을 확인할 수 있었다.

문제에 접속하면 위와 같은 화면이 나옵니다.

개발자 도구를 실행해보면

 <!-- 
      # default account: guest/guest
    -->

라는 코드를 확인할 수 있습니다. 이 것을 활용하여 guest로 일단 로그인해줬습니다. 로그인을 하면 관리자 계정이 아니라는 문구가 보입니다. 관리자 계정으로 접속하기를 바라는 듯했습니다.

 

EditThisCookie를 활용하여 쿠키값을 확인해보니 guest인 것을 확인할 수 있었습니다. 이를 admin으로 수정해보았습니다.

DH{7952074b69ee388ab45432737f9b0c56}

위와 같이 flag가 나오는 것을 확인할 수 있습니다.

LIST

'WarGame > Dreamhack' 카테고리의 다른 글

[Dreamhack|Web] session-basic  (0) 2022.05.03
728x90
SMALL

Task 1. Introducing LAN Topologies

Questions Answers Hint
What does LAN stand for? Local Area Network  
What is the verb given to the job that Routers perform? Routing This is the term given to deciding what route packets should take
What device is used to centrally connect multiple devices on the local network and transmit data to the correct location? Switch Something smarter than a hub/repeater
What topology is cost-efficient to set up? Bus Topology *** Topology
What topology is expensive to set up and maintain? Star Topology **** Topology
Complete the interactive lab attached to this task. What is the flag given at the end? THW{TOPOLOGY_FLAWS}  

Task 2. A Primer on Subnetting

Questions Answers Hint
What is the technical term for dividing a network up into smaller pieces? Subnetting  
How many bits are in a subnet mask? 32 This can be converted into 4 bytes
What is the range of a section (octet) of a subnet mask? 0-255 Smallest to largest
What address is used to identify the start of a network? Netwok Address ******* Address
What address is used to identify devices within a network? Host Address **** Address
What is the name used to identify the device responsible for sending data to another network? Default Gateway  

Task 3. The ARP Protocol

Questions Answers Hint
What does ARP stand for? Address Resolution Protocol  
What category of ARP Packet asks a device whether or not it has a specific IP address? Request  
What address is used as a physical identifier for a device on a network? MAC Address *** Address
What address is used as a logical identifier for a device on a network?
IP Address ** Address

Task 4. The DHCP Protocol

Questions Answers Hint
What type of DHCP packet is used by a device toretrieve an IP address? DHCP Discover DHCP ********
What type of DHCP packet does a device send once it has been offered an IP address by the DHCP server? DHCP Request DHCP *******
Finally, what is the last DHCP packet that is sent to a device from a DHCP server? DHCP ACK DHCP ***

 

LIST
728x90
SMALL

ctf-d의 Multimedia 문제중 위 '천 마디 말보다 사진 한 장...'이라는 문제를 풀었습니다. 문제에는 압축파일 하나가 주어져있습니다.

압축파일을 풀면 아래와같이 무수히 많은 파일들이 등장합니다. 이때 Hint에서 Grep은 항상 당신의 친구입니다라고 주어졌기 때문에 저는 Grep을 활용해 문제를 해결해 나갔습니다.

확장자가 없는 1000개의 파일중 JPEG를 찾아야되기 때문에 아래와 같은 명령어를 사용하였습니다.

명령어를 실행하자마자 UgeVjTlmZjNFvULk라는 하나의 파일을 발견했습니다. 그 파일을 실행하면 flag를 얻을 수 있습니다.

easyctf{it_must_be_pretty_hard_reading_this}

 

LIST
728x90
SMALL

HackCTF의 Crypto분야의 Classic Cipher -1 문제입니다. 문제에서는 압축파일 하나가 주어집니다. 이 압축파일을 해제하면 아래와 같은 문자가 적힌 텍스트파일 하나가 나옵니다.

?y4zl4J_d0ur_b0f_0K zp nhsm

이 문제에서는 힌트로 Hint : [::-1] 가 주어졌는데 이는 좌우반전을 의미합니다. 그래서 주어진 문자를 거꾸로 변환해주었습니다.

mshn pz K0_f0b_ru0d_J4lz4y? 라는 문자열이 만들어졌습니다. 카르시르 암호라는 것을 알수있습니다. 이를 아래의 사이트를 이용하여 암호를 해독해주었습니다.

https://www.dcode.fr/caesar-cipher

 

Caesar Cipher (Shift) - Online Decoder, Encoder, Solver, Translator

Tool to decrypt/encrypt with Caesar cipher (or Caesar code), a shift cipher, one of the most easy and most famous encryption systems, that uses the substitution of a letter by another one further in the alphabet.

www.dcode.fr

flag is D0_y0u_kn0w_C4es4r?

flag is D0_y0u_kn0w_C4es4r? 라는 해독결과가 나왔습니다. HackCTF{}라는 형식을 지켜 HackCTF{D0_y0u_kn0w_C4es4r?}라고 답안을 제출하면 정답이 뜨는 것을 알수있습니다.

LIST

'WarGame > HackCTF' 카테고리의 다른 글

[HackCTF|Misc] BF  (0) 2022.04.27
[HackCTF|Crypto]Smooth CipherText  (0) 2022.04.19
[HackCTF|Crypto]Great Binary  (0) 2022.04.19
[HackCTF|Web] WriteUp(2)  (0) 2022.04.19
[HackCTF|Misc]QRCODE  (0) 2022.04.15
728x90
SMALL

-[------->+<]>-.[--->++++<]>+.++.++++++++.[->+++<]>++.>-[--->+<]>-.[----->+<]>++.>--[-->+++++<]>.-[-->+++++<]>.----------.---[->+++<]>+.--------------.[--->+<]>-.------------.[-->+<]>---.-[----->+<]>--.---.-[-->+<]>----.-[----->+<]>--.[-->+<]>-.------[->++<]>-.-[->++++++<]>.---[->++<]>.[-->+<]>-.+[--->++<]>-.-.+[->+++<]>.[--->+<]>-.------------.[-->+<]>-.---[->++<]>-.[--->+<]>+.-.---------.++.[-->+<]>----.++++++[->++<]>.[-->+<]>-----.---[->++<]>.[-->+<]>.+++++[->++<]>.[-->+<]>-----.[--->++<]>--.+++++.[->+++++<]>++.-[->++++++<]>.+++[->++<]>.[-->+<]>---.++[->++<]>.-[--->+<]>.-[++>---<]>+.----.++++.-----[->++<]>-.---[->++++<]>.++.--[->+++++<]>.+++++[->++<]>.[-->+<]>--.-[->++<]>-.-[--->+<]>--.+++++++++.

HackCTF Misc의 BF문제입니다.  문제를 클릭하면 위와같이 난해한 코드들이 등장하는 것을 볼 수 있습니다. 위 코드는 브레인퍽이라는 언어입니다. 아래의 사이트에서 코드를 해독해줬습니다.

https://www.dcode.fr/brainfuck-language

 

Brainfuck Language - Online Decoder, Translator, Interpreter

Tool to decode/encode in Brainfuck. Brainf**k is a minimalist programmation language that takes its name from two words that refer to a kind of cerebral masturbation.

www.dcode.fr

HackCTF{1'm_th1nk1n6_4b0ut_th3_vuln3r4b1l1ty_4n4ly515_pr0j3ct}

 

LIST

'WarGame > HackCTF' 카테고리의 다른 글

[HackCTF|Crypto]Classic Cirpher -1  (0) 2022.04.27
[HackCTF|Crypto]Smooth CipherText  (0) 2022.04.19
[HackCTF|Crypto]Great Binary  (0) 2022.04.19
[HackCTF|Web] WriteUp(2)  (0) 2022.04.19
[HackCTF|Misc]QRCODE  (0) 2022.04.15
728x90
SMALL

Rijvsmysmysmy Itovwyrc! Ns wyy ixsu Glm kq G? wc lkqc sw qwsmdlkkr sr...M ixsu fipi acvp urer iss geld! Md iss mel niastfov rrmq mvwzxmqvyw, cme gyx kcd xfo gmbvcmx yxwuov. qy, jjkk gc LymoADJ{t_tzwi_3vxbd0p3_vff.afy'q_wzoxpq_dp_qfz}

플래그 형식을 갖춘것으로 보아  비즈네르 암호임을 추측할 수 있었다. 아래의 사이트를 통하여 비즈네르 암호를 풀었다.

https://www.dcode.fr/vigenere-cipher

 

Vigenere Cipher - Online Decoder, Encoder, Solver, Translator

Tool to decrypt/encrypt Vigenere automatically. Vigenere cipher is a poly-alphabetic substitution system that use a key and a double-entry table.

www.dcode.fr

첫번째 복호화 결과 flag 부분이 아직 완전히 해독되지 않아 flag를 입력하면 오류가 뜬다. 그래서 flag 부분만 복사해서 한번 더 복호화를 해줬다.

HackCTF{i_will_3emem0e3_you.don't_forget_me_too}

정상적인 플레그가 출력되는 것을 확인할 수 있다. 괄호안에 flag를 HackCTF{}형식으로 입력을 하여 flag를 제출하면 정답이라고 뜬다.

LIST

'WarGame > HackCTF' 카테고리의 다른 글

[HackCTF|Crypto]Classic Cirpher -1  (0) 2022.04.27
[HackCTF|Misc] BF  (0) 2022.04.27
[HackCTF|Crypto]Great Binary  (0) 2022.04.19
[HackCTF|Web] WriteUp(2)  (0) 2022.04.19
[HackCTF|Misc]QRCODE  (0) 2022.04.15

+ Recent posts