# NHISCCTF 題目解析 ## [Welcome] ### Base64 something... 直接base64解密就好了 ![1](https://hackmd.io/_uploads/rJkAhS0Syg.png) ``` NHISCCTF{W3lc0me_t0_NHISC_CTF_2024!_H0p3_y0u_c4n_h4v3_fun( ̄▽ ̄)} ``` ### chaos 照著提示給的解密順序解 ``` base64 -> binary -> hex -> caesar ``` 最後解到凱薩的時候用[https://www.dcode.fr/en](https://www.dcode.fr/en)解 ![2](https://hackmd.io/_uploads/B1usprAByg.png) ``` NHISCCTF{CrYpT0_1s_FuN_4nD_Ch4LL3nG!nG} ``` ### game.py 下載完直接看程式碼就好了 ```python= import sys import time import base64 import re def validate_input(user_input): pattern = r'^\d{5}$' return bool(re.match(pattern, user_input)) def main(): while True: user_input = input("請輸入班級學號 (格式: 班級座號 ; 例:20826): ") if validate_input(user_input): break print("格式錯誤,請重新輸入!") encoded_flag = "TkhJU0NDVEZ7VzNsYzBtZV83MF9OSElTQ0NURl8zbmoweV83aDNfZzRtMyEhIX0=" print("Hello", user_input) sys.stdout.write("Decoding") for _ in range(3): sys.stdout.write("...") sys.stdout.flush() time.sleep(0.5) print("\n") flag = base64.b64decode(encoded_flag).decode('utf-8') print(f"Congratulations!!!\nHere is your flag : {flag}") if __name__ == "__main__": try: main() except KeyboardInterrupt: print("\nProgram has stopped") sys.exit(0) ``` 把`TkhJU0NDVEZ7VzNsYzBtZV83MF9OSElTQ0NURl8zbmoweV83aDNfZzRtMyEhIX0=`做base64解密 ``` NHISCCTF{W3lc0me_70_NHISCCTF_3nj0y_7h3_g4m3!!!} ``` ## [CTF LINUX] ### very secret 右鍵複製下載到linux之後解壓縮 * 第一步 ``` wget [複製的網址] ``` * 第二步 ``` unzip [下載出來的zip壓縮檔] ``` * 第三步 ``` grep -r NHISC verysecret #verysecret是資料夾 ``` ![3](https://hackmd.io/_uploads/rkzdkI0Hyx.png) ``` NHISCCTF{Th3_v3555555555555555555555555555555559_s11111111111111111C23T_f1aaaaaag} ``` 補個grep的用法 -> https://blog.gtwang.org/linux/linux-grep-command-tutorial-examples/ ### easy linux command 就照著題目的要求打在flag的框框裡 ``` NHISCCTF{ls;pwd;cd..;cd /home/NHISCCTF/flag;cat flag.txt} ``` ## [CTF WEB] ### IDOR You to Try 在網址後加入`?id=0` 最後會長這樣 -> `https://xzhiyouu-web.pages.dev/IDOR?id=0` ``` NHISCCTF{ID0R_1s_4_C0mm0n_Vuln} ``` ### Where are Admin’s cookies? 進去之後會發現一個可以輸入密碼的東西,除非你猜到密碼是`admin123`,不然就只能用題目給的方式去解 -> `用cookie修改值` 我們發現`adminCookie`的值是`1` 如果改成`0`的話就可以得到flag ``` NHISCCTF{i_want_to_eat_c0okie} ``` ### 683280 ~~水題用猜的應該都可以猜出來~~ 題目給了提示`683280 = (_ _ _) * (_ _ _ _)` 進到網頁的計算機輸入`520*1314`就好了 ``` NHISCCTF{l0v3_y0u_f0r3v3r!} ``` ### D3c0d3 Adventur3! ᓚᘏᗢ ~~好像是最靠腰的一題 但其實不難~~ 1. 根據提示`🤫🤫🤫🤫🤫🤫`可以發現網頁裡也有一個一樣的東西,或是查看原始碼可以發現那是一個按鈕,點下去會跳出這個 ![4](https://hackmd.io/_uploads/SJyfMLRHJe.png) 拿去base64解密後會發現`Try to look at robots.txt?` 所以直接查看網頁的`robots.txt` ``` User-agent: * Disallow: /flag2 Disallow: /secret Disallow: /admin . . . . . . . . . . . . . . . . . . The first part of flag(1/5): TkhJU0NDVEZ7dzNsY29tM190MF90aA== ``` 發現第一段flag,拿去base64解密 ``` NHISCCTF{w3lcom3_t0_th ``` 接著依序進到`/flag2`、`/secret`、`/admin` 2. 進入`/flag2`會發現你瀏覽器壞掉了,對這是故意的很正常,一樣檢查原始碼 ```html= <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 404 (Not Found)</title> <link rel="stylesheet" href="style.css"> </head> <body> <a><span id="logo" aria-label="Google"></span></a> <p><b>404.</b> <ins>That's an error.</ins></p> <p>The requested URL <code>/404</code> was not found on this server. <ins>That's all we know.</ins></p> <!-- I use CSS to make the website look nice --> </body> </html> ``` 他說`I use CSS to make the website look nice`,所以flag可能在網頁的css裡 進到css裡後會看到 ```css= /* The second part of flag(2/5): 33 5F 64 33 63 30 64 33 5F 74 30 30 6C 73 5F 79 30 75 5F 61 72 33 5F */ ``` 這是hex十六進位,拿去轉成看得懂的text會得到 ``` 3_d3c0d3_t00ls_y0u_ar3_ ``` 3. 接著進入`/secret` 我發現其實可以直接複製,但是這樣就看不到剩下最後一段flag的提示 預期解是在網址前面加上`view-source:`,就可以看到網頁原始碼 ~~但我發現我忘記禁用Crtl+U~~ 把得到的密文做凱薩解密 ![5](https://hackmd.io/_uploads/rk-ZB80B1x.png) ``` r3ally_g00d_at_d3c0d3ng_ ``` 並且可以得到第四段flag的提示 ```html= <!-- 第四段flag在一開始的解密網頁裡 --> ``` 4. 回到正常的解密網頁,會發現有一個flag的選項 ![6](https://hackmd.io/_uploads/ryeYS8RB1x.png) 把分段的flag一一拿去解密就可以拼成第四段flag `bjB3Xw==` -> `n0w_` #base64 `u0c3_` -> `h0p3_` #rot13 `796f755f` -> `you_` #hex `01100011 01100001 01101110 01011111` -> `can_` #binary `102` -> `f` #decimal ``` n0w_h0p3_you_can_f ``` 5. 最後一段在`/admin` 進去之後直接輸入帳號`admin`、密碼`20826`,就能拿到第五段flag ``` 1nd_m0r3_flags} ``` 最終的flag為 ``` NHISCCTF{w3lcom3_t0_th3_d3c0d3_t00ls_y0u_ar3_r3ally_g00d_at_d3c0d3ng_n0w_h0p3_you_can_f1nd_m0r3_flags} ``` ## [BONUS] ### My First OSINT 就是找學校地址而已 ``` NHISCCTF{114台北市內湖區文德路218號} ``` ### 神秘的校網 進去原始碼找關鍵字`NHISC` ``` NHISCCTF{Y0u_kn0w_DevTools_w0w!!!} ``` ### QR CODE 掃進去就有了 ``` NHISCCTF{QR_c0d3_my_f4v0r1t3} ``` ### 1mag3 !nf0rm4t1on 原始解法是讓大家熟悉怎麼在linux查看圖片的一些資訊 ![7](https://hackmd.io/_uploads/Bk4m_8CSJe.jpg) `TkhJU0NDVEZ7M3hpZjcwMGxfMXNfNF9nME9kXzdvb2xfZm9yX2NoM2NrMW5nXzFtYWczfQ==`拿去base64解密 ``` NHISCCTF{3xif700l_1s_4_g0Od_7ool_for_ch3ck1ng_1mag3} ``` ### b1t pl4n3 進去網址上傳flag圖片後點`Browse Bit Planes` 移動到`Red 1`時就會發現flag出來了 ``` NHISCCTF{b1t_pl4n3_7h3_b3st} ``` ### Strings the challenge!!! 預期解也是用linux解,主要是熟悉strings這個指令 ![8](https://hackmd.io/_uploads/r1_GY80ryl.png) ``` NHISCCTF{Y0u_4r3_g00d_a7_c41cu!a7ing!!!} ``` ### I love base64 so much☆*: .。. o(≧▽≦)o .。.:*☆ 這題很靠邀,主要是我想到之前寫高中職資安教學資源與推廣中心的CTF有寫到一樣的題目 解法就是一直給他base64解密就好了(~~我忘記幾次~~) ``` NHISCCTF{7h4T_$uch_4_b1g_d4ta_w0wwwwwwwwwwwwwwwwwwwwwwwwww!!!} ``` ### VIRUS IN THE FILE!!!! 下載到電腦之後不要執行(提示有講),請用記事本之類的打開 可以看到原始碼 ```bash= @echo off chcp 65001 >nul title File Trap CTF color 0A setlocal enabledelayedexpansion for /L %%i in (1,1,25) do ( echo WARNING: Do not open suspicious files! > %%i_flag_file%%i.pdf ) for /L %%i in (1,1,25) do ( echo WARNING: Do not open suspicious files! > %%i_flag_file%%i.docx ) for /L %%i in (1,1,25) do ( echo WARNING: Do not open suspicious files! > %%i_flag_file%%i.mp3 ) for /L %%i in (1,1,25) do ( echo WARNING: Do not open suspicious files! > %%i_flag_file%%i.mp4 ) for /L %%i in (1,1,25) do ( echo WARNING: Do not open suspicious files! > %%i_flag_file%%i.txt ) set "real_flag=NHISCCTF{D0n't_0p3n_uns4f3_f1l3!!!}" echo %real_flag% > 19_flag_file19.txt rem Start the loop to continuously echo the message :loop echo You have been hacked :-( goto loop echo Files created successfully. pause ``` ``` NHISCCTF{D0n't_0p3n_uns4f3_f1l3!!!} ``` 本人幫你們實測一下執行檔案會發生什麼事 ![9](https://hackmd.io/_uploads/r1ZO98Crkx.jpg) ### whip-whiplash 這題是隱寫題 題目說先用srtings看檔案 strings 這個指令可以用來找出非文字檔裡的可列印字元 所以可以先找到`passwd: aespa` 接著根據第二個提示我們要用`steghide`這個指令 詳細可以看這篇 -> https://ithelp.ithome.com.tw/m/articles/10323531 ![10](https://hackmd.io/_uploads/SJGUs8AHJg.png) 然後把`secret.txt` cat出來解密就好了 ![11](https://hackmd.io/_uploads/BysZnI0H1e.png) ``` NHISCCTF{wh1p-whipl4sh><} ``` ### png chunk 這題跟THJCC 2024 winter的題目一樣 首先我們要有`tweakpng`這個軟體 -> [載點](https://entropymine.com/jason/tweakpng/) png chunk的意思就是 png 的區塊 先用 https://www.nayuki.io/page/png-file-chunk-inspector#google_vignette 查看後會發現 png 結構有錯 ![13](https://hackmd.io/_uploads/SJ-ma8AHJl.png) tweakpng查看後 ![14](https://hackmd.io/_uploads/rydnp8AHJl.png) 移到上面就好了 ![15](https://hackmd.io/_uploads/BysyAIASyg.png) 最後得到flag圖片本人 ![16](https://hackmd.io/_uploads/Hk0HCIRrJx.jpg) ``` NHISCCTF{PN9_@$_Y0u_l00k_sO} ```