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

Social Value 인증서
연구 멘토링 프로그램 수료증
청소년 스태프 수료증 및 키트

2021.07.30.

코로나19로 인해 온라인으로 진행된 KSCY16이 끝이 났습니다. SNS를 통하여 우연히 KSCY를 알게 되어 STAFF로 참여를 하게 되면서 많은 경험을 하게 된 것 같습니다. 처음 KSCY를 알게 되었을 때는 '학술대회'라는 것이 진입장벽이 매우 높아 보였습니다. 하지만 지원을 하여 KSCY16 STAFF로 활동을 하면서 생각했던 것보다 어렵거나 힘들지 않았고 피실리 에이터 분들도 굉장히 친절하고 재밌으셔서 활동을 흥미롭게 진행해 나갔던 거 같습니다. 처음 참여를 하는 활동이라 학술대회라는 것의 이해도를 높이고 싶어 STAFF로 참여를 해보았습니다. STAFF로 활동을 하며 많은 사람들에게 청소년도 자신의 연구논문을 발표할 수 있는 활동이 있다는 것을 알리고,  STAFF 활동뿐만아니라 저도 관심이 있는 분야와 다양한 분야의 발표를 들으며 다양한 사람들과 의견을 공유하며 새로운 지식을 학습 할 수있었습니다. KSCY16은 여름 방학이라는 짧은 기간 동안 저를 한 층 더 성장시킬 수 있었던 흥미로운 활동이었습니다. 이 활동을 기반으로 저의 관심분야의 대한 연구 논문을 발표 할 수 있기를 바라며 학습하겠습니다.

LIST
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

+ Recent posts