###### tags: `程安` # CS 2019 Fall - Homework 0x09 ### [0x09] Cathub Party * 一樣的 Cathub,但多了一個`★Join Party`可以按 ![](https://i.imgur.com/ik5KVlb.png) * 隨便註冊一個帳號之後 ![](https://i.imgur.com/vfMgEv1.png) * 原來藏在 cookie 裡 ![](https://i.imgur.com/caqar8H.png) * 如果我們把 cipher 亂改 ![](https://i.imgur.com/IPByOD8.png) * 看來是被 base64 過的 cipher,然後上課的時候已經說過他是 padding oracle 了。這邊使用網路上找到的工具,可以高速解 padding oracle <3 :::info Tool : [padding_oracle.py (multi-thread)](https://github.com/djosix/padding_oracle.py) ::: * 稍微修改他的`example.py` ```python= def oracle(cipher): cookie['FLAG'] = base64_encode(cipher) cookie['FLAG'] = urllib.parse.quote(cookie['FLAG']) r = sess.get(url, cookies=cookie, verify=False) assert 'CAT PARTY!!!!!!' in r.text or 'get out of here.' in r.text return 'CAT PARTY!!!!!!' in r.text # cipher = b'[___IV___][_Block1_][_Block2_]...[_BlockN_]' cipher = base64_decode(cookie['FLAG']) block_size = 16 num_threads = 32 plaintext = padding_oracle(cipher, block_size, oracle, num_threads) ``` * `FLAG{...}`的 F 會猜不出來是因為前面沒有東西可以再拿來微調猜測了。 但無所謂,反正本來就是知道會長`FLAG{...}`這樣 :::success ![](https://i.imgur.com/bmA1Tef.png) `FLAG{EE0DF17A410C90F86E88471346B6DA77E8C878200B37E60C53E9A56913211465}` :::