## ****There Is Nothing Here (1)**** 題目 ![Untitled](https://hackmd.io/_uploads/Syzh25hKT.png) 題目給的圖片拿遠一點話可以隱約感覺出來應該是個被裁切過的 QR code 當時想到的解法是先改改看原圖片的尺寸 丟到 010 Editor 裡面改一下尺寸 (要找到檔案標頭的資訊可以搜尋看看”**jpg header format**“) ![Untitled 1](https://hackmd.io/_uploads/B1Ul6qnta.png) 先看一下圖片原本的尺寸 ![Untitled 2](https://hackmd.io/_uploads/HyXGTchKT.png) 那就回到 010 Editor 先改成正方形的 1024x1024 試試看 ![Untitled 3](https://hackmd.io/_uploads/BydXT53KT.png) 打開之後就可以蠻明顯的感覺出來是一張 QR code 了 ![Untitled](https://hackmd.io/_uploads/BJhV6q3Fa.jpg) 接著用手機掃掃看就可以掃出 flag 了 ![IMG_8241](https://hackmd.io/_uploads/rJztac2tT.png) --- ## ****There Is Nothing Here (2)**** 題目只有提供一個 vhdx 檔 ![Untitled 4](https://hackmd.io/_uploads/Sy826q3FT.png) 那就先掛上本機看一下 ![Untitled 5](https://hackmd.io/_uploads/By8aac2Ya.png) ![Untitled 6](https://hackmd.io/_uploads/B1ZyRq2Fa.png) 這裡我先懷疑是跟上一題的手法一樣所以也改看看 card.jpg 的尺寸 先改成 460x460 試試看 ![Untitled 7](https://hackmd.io/_uploads/Skxg052Yp.png) 打開後就可以看到隱藏資訊了 根據圖片資訊這題的 flag 為 TSC{<AD_FULL_FQDN>_<ADMIN_PASSWORD>} ![Untitled 1](https://hackmd.io/_uploads/BkoWRq2YT.jpg) 這裡提示了有 ntds.dit 跟 fasttrack.txt 兩個檔案 但是剛剛用檔案總管沒看這些檔案 出動Autopsy 掃一下有哪些隱藏檔案 ![Untitled 8](https://hackmd.io/_uploads/r1-Q0qnKp.png) 原來剛剛那張圖片有鬼🤔 把 card.jpg:ntds.zip 提取出來並解壓所就可以看到有 fasttrack.txt 跟兩個資料夾 ![Untitled 9](https://hackmd.io/_uploads/HkAXRqnt6.png) 接著先搞懂一下他剛剛提示的 ntds.dit 這個檔案是在幹嘛的 這裡我參考了這篇文章: [Active-Directory-Pentest-Notes/Notes/域渗透-获取NTDS.dit.md at master · uknowsec/Active-Directory-Pentest-Notes (github.com)](https://github.com/uknowsec/Active-Directory-Pentest-Notes/blob/master/Notes/%E5%9F%9F%E6%B8%97%E9%80%8F-%E8%8E%B7%E5%8F%96NTDS.dit.md) 接著我參考了上述文章提到的 **secretsdump.exe** 來看一下 ntds.dit 裡面存了哪些帳號 ![Untitled 10](https://hackmd.io/_uploads/B1fHCqhK6.png) 其實上圖這裏正常來說應該是會有 AD 的 FQDN,但是不知道為甚麼這個檔案解析出來沒有 有 AD FQDN 的範例 ![Untitled 11](https://hackmd.io/_uploads/SyaHCqnt6.png) ⬆️[Image source](https://www.cnblogs.com/PatrickStar88888888/p/15309196.html) 所以我們現在得知了 Administrator 密碼雜湊值為 “**674e48b68c5cd0efd8f7e5faa87b3d1e**” 接著我們就要來破解 Administrator 的密碼了,通常的作法是把它提供的 fasttrack.txt 裡面所有字串去 hash 然後看有沒有吻合的,但是因為剛剛密碼雜湊是用 NTLM 加密的,我臨時找不到批量加密的工具,所以這裡偷懶用一下[線上工具](https://crackstation.net/)來查看有沒有關於上面雜湊值的資料 ![Untitled 12](https://hackmd.io/_uploads/HkbPR92Ka.png) 所以 Administrator 的密碼就是 “**welcome**” 那AD的FQDN我沒想到有什麼方法找,所以我就去了 ntds.dit 裡面翻翻看能不能剛好翻到 然後皇天不負苦心人還真的被我翻到了 ![Untitled 13](https://hackmd.io/_uploads/rkav05hKp.png) flag:TSC{tsc_ctf_AD.local_welcome} --- ## ****CCcollision**** 題目 ```python from hashlib import md5 from string import ascii_lowercase, digits from random import choice from secret import FLAG def get_random_string(length): return "".join([choice(ascii_lowercase + digits) for _ in range(length)]) prefix = get_random_string(5) hashed = md5(get_random_string(30).encode()).hexdigest() print("here is your prefix: " + prefix) print("your hash result must end with: " + hashed[-6:]) user_input = input("Enter the string that you want to hash: ") user_hash = md5(user_input.encode()).hexdigest() if user_input[:5] == prefix and user_hash[-6:] == hashed[-6:]: print(FLAG) ``` 可以從 source code 看到輸入的字串前五個字要符合他隨機產生的字串並且輸入的字串經過 MD5 hash 後的後六碼也要符合題目隨機產生的字串經過 MD5 hash 後的後六碼 所以我們要輸入的字串前五個字跟md5的雜湊後六碼都要符合題目提供的 先連線進去看看 ![Untitled 14](https://hackmd.io/_uploads/ryF_0chtT.png) 這裡可以看到他回傳給我們要求的 prefix 跟雜湊的後六碼 解題的 code 大概就長這樣 (~~運氣好的話跑一下就出來了~~) ```python from hashlib import md5 from string import ascii_lowercase, digits from random import choice def find_string(target_suffix): prefix = "3fgyy" while True: candidate = prefix + get_random_string(25) candidate_hash = md5(candidate.encode()).hexdigest() if candidate_hash[-6:] == target_suffix: return candidate def get_random_string(length): return "".join([choice(ascii_lowercase + digits) for _ in range(length)]) target_suffix = "5a7d68" result = find_string(target_suffix) print("Generated string:", result) ``` 然後把上面產出的字串丟回去就能拿到 flag 了 ![Untitled 15](https://hackmd.io/_uploads/HJLFRq2Ya.png) --- ## ****My First Shopping Cart**** 題目長這樣 ![Untitled 16](https://hackmd.io/_uploads/rJrqA9nYT.png) 這裡用先隨便加個東西(Canoooooo1 3000D Camera)進購物車並用 burp suite 攔截封包看一下 ![Untitled 17](https://hackmd.io/_uploads/Bk09RqhK6.png) 把原本放產品名稱的地方改成 flag 並送出看看 ![Untitled 18](https://hackmd.io/_uploads/rJLoR53tT.png) 之後就可以在購物車看到 flag 了 ![Untitled 19](https://hackmd.io/_uploads/rJy3A5ntp.png)