2020 1/21(火) 1:00 ~ 1/25(土) 16:59 JST に開催された、Rice Tea Cat Panda CTF の Genral Skills ジャンルのwriteup。
writeup一覧・戦績はこちら
[General Skills] Come Eat Grandma (25pt)
Oh, my bad, this spreadsheet appears to be missing its commas.
Hints
https://docs.google.com/spreadsheets/d/1EQDYaEU9jWZGIh96nGQpzpMnMdcT9ukZGT5GwRBfos4/edit?usp=sharing
DO NOT edit/remove competition resources. You will be banned.
flagっぽい文字列などたくさんありますが、どれも違います。変更履歴を表示すると、怪しい履歴が。
見てみると、flagがありました。
[Genral Skills] Basic C4 (30pt)
If you use that bomb, you might cause an Avalanche...
Let's not destroy my IO, ok?
Hints
The flag starts with c4
Submit in the format: rtcp{90-char-flag}
da_bomb.txt
が配布されます。
SGFoLCB5b3UgdGhvdWdodA== UmVhbGx5PyBEaWQgeW91IGFjdHVhbGx5IGtlZXAgZ29pbmc= bG93a2V5IGRpc3NhcG9pbnRlZC4uLg== ZnVuIGZhY3Q6IEplc3MgaXMgYWN0dWFsbHkgYSBjYXQ= bWVycA== Kmluc2VydCBmaWxsZXIgbWF0ZXJpYWwgaGVyZSo= d2VscCB0aGF0IHNob3VsZCBiZSBlbm91Z2ggZGF0YQ== aWYgeW91IGNhbid0IHRlbGwgYWxyZWFkeSwgZGVjb2RpbmcgdGhpcyBpc24ndCB0aGUgYW5zd2Vy
タイトルからしてbase64っぽいですが、回答チーム数が少なすぎます…。なぜ…?
一文ずつ最後にpaddingが付いているので、一文ずつ base64 decode します。
Hah, you thought Really? Did you actually keep going lowkey dissapointed... fun fact: Jess is actually a cat merp *insert filler material here* welp that should be enough data if you can't tell already, decoding this isn't the answer
base64 decodeするのが答えじゃないらしい。
バイナリエディタで見ても怪しいところはなし。
うーん、よくわからず、競技は終了。
writeupを見てみると、このサイトに与えられたtextファイルを投げると答えが返ってくるらしい。
うーん、あとから調べてみても、日本語検索だとヘルメットやバンドが引っかかるし、英語圏用検索にしても車やサプリが引っかかるし、何をもとに調べればよかったのか不明。
あ、GitHubで Avalanche IO C4
でコード検索したら出てきた。ふむー。
[General Skills] Sticks and Stones (50pt)
may break my bones but words could never hurt me
Hints
https://github.com/JEF1056/riceteacatpanda/tree/master/Sticks and Stones (50)
githubの該当のディレクトリには、READMEと巨大なテキストファイルworbz.txt
があります。巨大すぎてエディタでは開けないので、DLしてコマンドラインから操作します。
ちょっと開いてみた感じ、rtcp{...}
のフォーマットの文字列が沢山ありそうだったのですが、 rtcp{...{}
みたいになっていたりしたので、まずは正しいフォーマットのもののみを抽出します。
$ grep -Eo rtcp{[^{}]*} worbz.txt > candidates.txt
それでも
$ wc candidates.txt 44698 44698 1288654 candidates.txt
4万行!
でもここからフィルタリングする方法を思いつかなかったので、エイヤで _
を使ってるのがflagなんじゃない?と思って検索してみた。ら、最初に引っかかったこれがflagでした。
[General Skills] NO¯Γ̶ IX (75pt)
I can't seem to figure out this broken equation... a lot seems to be missing... the author said that
meow = Totally [Chall Title]
100-hex(meow)=flag!
Hints
put in the flag format: rtcp{[hex humber]}
or as just the hex: [hex number]
the flag is positive
75pt問題なのに、これも解けたチーム少なすぎ!どうしてだ…。難しいのか…。エスパー問なのか…。
IX
はローマ数字だと9を表します。でも¯Γ̶
これはなんだ。ぐぐったら"Γ, γはギリシア文字の第3番目の文字。数価は3。"と出てくるけど、ちょっと形が違う気がする。横線が足りない。
よくわからないけど、下記のように読み替えて計算してみます。
¯: ? Γ̶: 3 IX: 9
0x39 = 57 100 - 57 = 43 43 = 0x2b
違った。
でも待てよ。100-hex(meow)=flag
で、flagは正の数の場合は、0 <= flag <= 100
だから100回フラグ投げればよくね?…と思ったけど、hex(meow)が負数の可能性もあるし、blure forceでbanされたら嫌なのでやめといた。
あとでwriteup読んだら、なんとタイトルは NO = 9
と解読するのが正解だったようで。
0x100 - hex(9) = 0xF7
flag: rtcp{F7}
配点が低いことから、難しいことは考えずにローマ数字だけ気にした、というwriteupがあった。なるほど。
[General Skills] Types of Rice and Cookies, Because Those Definitely Go Together Well (100pt)
It's important to know all the different kinds of rice. After all, what kind of cook would Delphine be if she couldn't identify the different types? But GIANt needs to learn too. So Delphine is having him research different kinds of cookies. She wants him to find the cookie that help websites remember her information and settings when she visit them in the future. Creepy? Yes. Important? Also yes.
Hints
This challenge still follows typical flag format, just wrap your answer with rtcp{answer_here}.
Non-case sensitive.
どうやらcookieに関連する問題のようなので、cookieを確認してみるも、特に怪しいのはない。ほかの問題のときからバリバリ使っているsession
のみで、これはflagではなかった。
Cookie types | aboutcookies.org.uk
この辺のcookieの種類をflagに突っ込んだら通りそう。
...と思ったけど時間内には通るフラグが見つからなかった。
...と、復習でもう一度やってみたら、下記で通った。問題文の通りの意味のcookie。
flag: rtcp{persistent_cookies}
競技中は終了間際で焦っていたので、多分入れたと思うんだけど大文字小文字・アンスコハイフン・単数複数あたりは全部試していなかったかも知れない…。もったいない。
[General Skills] Grandma's Recipes (100pt)
So Delphine and the GIANt wanted to make a recipe that Delphine's grandma passed down to her. The problem is, her grandma is extremely tech-savvy. In fact, she likes using a Certain Website on the endless Inter-Webs. She says it's very useful for storing her recipes. It'll be kinda hard for Delphine and the GIANt to git her recipes though; they don't know her username. Oh well. But hey, they know that she likes naming things after the Holy Rice Goddess.
I wonder what recipe Delphine and GIANt are making. . .
問題文から察するに、おばあちゃんはGithubユーザーで、Guthubの中から"the Holy Rice Goddess"にちなんだユーザー名を探せば、そこにレシピがある…かも知れない。OSINTだな。このCTF全体的にそんな感じだけど。
ということで、githubのsearch機能で Holy Rice Goddess
を検索してみると、1repositoryがhitしました。
GitHub - pandaram/holy-rice-goddess-recipes
ここのmeatloaf_recipe.txt
にflagがありました。
[Grandma’s Meatloaf Recipe] Ingredients: -Meat -Uh some secret ingredients -Some spices -A dash of attitude -A sprinkle of sass Steps: -Combine -But like, combine in the right order -And then you get this: rtcp{ju5t_l1k3_gr4ndm45_m34tl04f_1029837}
[General Skills] pandamonium (100pt)
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
91 7 10 D 95 42 28 A
Hints
underscore between 6th and 7th char, not including the flag wrapping (rtcp{})
競技中は解いたチームが少なかったので手を出さなかった問題。
pandamonium
を調べてみると、panda
とpandemonium
の造語とのこと。後者は「大混乱・地獄」などの意味があるらしい。
問題文のA
は72文字。その下のリストは8個。DやAがあるので16進数として考えるのかな?
と、色々考えてみたもののやっぱりわからなかったので、他のwriteupを見てみる…。
元素の周期表!!
全然思いつかなかった。
91: Pa 7: N 10: Ne D: D 95: Am 42: Mo 28: Ni A: A
ということで、フラグは
flag:rtcp{PaNNeD_AmMoNiA}
どうやって周期表にたどり着くのか未だにわからないが、pandamonium
という造語から化学っぽい匂いを感じるとかかなぁ。あとはA×72
の使い方もわからないままであった。
[General Skills] Treeeeeeee (100pt)
It appears that my cat has gotten itself stuck in a tree... It's really tall and I can't seem to reach it. Maybe you can throw a snake at the tree to find it?
Oh, you want to know what my cat looks like? I put a picture in the hints.
Hints
Here, my cat looks like this:
#FFC90E#FFC90E#FFC90E#FFFFFF#FFFFFF#FFFFFF#FFFFFF#FFFFFF#FFC90E #FFC90E#000000#FFC90E#FFFFFF#FFFFFF#FFFFFF#FFFFFF#FFC90E#FFFFFF #FFC90E#FFC90E#FFC90E#FFC90E#FFC90E#FFC90E#FFC90E#FFFFFF#FFFFFF #FFFFFF#FFFFFF#FFC90E#FFC90E#FFC90E#FFC90E#FFC90E#FFFFFF#FFFFFF #FFFFFF#FFFFFF#FFC90E#FFC90E#FFC90E#FFC90E#FFC90E#FFFFFF#FFFFFF #FFFFFF#FFFFFF#FFFFFF#FFC90E#FFFFFF#FFC90E#FFFFFF#FFFFFF#FFFFFF
他、treemycatisin.7z
が配布されます。これを解凍するとおびただしい数のdirectoryとjpg画像が。
ヒントの文字列は、おそらく色を表しているので、これでお絵描きしてみます。
エクセルでお絵描きしてみた。これが猫ちゃん。
まずは、下記コマンドで、このビッグツリーから画像のパスのリストを作ってみます。
$ find . -name *.jpg > jpgs.txt $ wc jpgs.txt 1337 1337 64175 jpgs.txt
1337枚。まぁそんなに無いかな!気合で目でも探せそう。でもちゃんとスクリプト書く。
このリストをもとに、全画像をhash化して比較、よく見る画像が2パターンあるので、それ以外の画像が出てきたらきっとそれがflag。
import hashlib hashs = {} with open('jpgs.txt', 'r') as f: img_paths = f.readlines() for path in img_paths: path = path.strip() with open(path, 'rb') as f: md5 = hashlib.md5(f.read()).hexdigest() hashs[md5] = path print(hashs)
実行結果
$ python solve.py { '49390dd9695e7ab7c49fbea6697bc1a9': './bigtree/NUD67JGK/CIXOYN/9FRPBEDP8Y/B53Y83BADE/VJ3B0/2YB5L.jpg', '2d7b81239b77deb7fbda026d9521939b': './bigtree/NUD67JGK/CIXOYN/9FRPBEDP8Y/3NVWWNNEM/YZ1LGD8Z/TIXRMLR32K.jpg', 'aeb3e033f8bdbf2ec44fda714da72f77': './bigtree/P24AKQCA/I0E91C/6SF60/N02AKM/EAJCOQ6/ENP92.jpg' }
※ちょっと整形した。
最後の出力のpathにあるのがflag。
ちゃんとさっきの猫ちゃんもいました。(使わなかった)
[General Skills] Editor (300pt)
Mr. Willis, my computor science principals teacher, taught us how to web scrape using google sheets! He assinged us a webscraping prodjects and it's due soon and I finished it, but some of these functions aren't working because of my atrosious spelling >.< can you please help me edit my spelling?
Objectives: Edit the spelling of the google sheets functions
Notes: Make a personal copy of the sheets document to edit. Don't edit E22. Only edit the functions themselves, all values and URLs should be correct.
Creator: houseplant delphine
Feb 2020
復習してたら出てきた。上記の日付を見ても、コンテスト終了後に作った問題っぽい。
リンク先に飛んでみると、Come Eat Grandma と同じく、Google Spread Sheetに飛ばされます。
#NAME?
や#ERROR!
になっている欄が多かったため、自分のSpreadSheetにコピーして修正していきます。関数名の一文字が違っていたりカッコの形が違っていたりとちまちました修正をしていくと、E22にflagが表示されました。
[General Skills] ghost-in-the-system (1500pt)
I think my ls is being haunted... the colors are all weird!!! What's that? It's highlighting things?! Where!!?
Hints
Flag is 100 characters long.
It starts with rtcp{ and ends with }
The first character is w
The flag is written in standard leet, the only exceptions are the flag wrapping (rtcp{}) and underscores (_)
他、ls
という名前の実行ファイルが配布されます。
1500ptの割には、解いてる人が多い…。難易度と点数はこのCTF崩壊気味。
linux上で、試しにls
ファイルを実行してみます。
実行してみると、確かに機能としてはls
の機能を果たしていますが、coloringが変。一文字ずつ違う色になってる。同じ文字は同じ色なので、文字によって色の値が変わる仕組みのようだ。
ghidraにdecompileしてもらったのと、radare2で見てみた所、怪しい文字列(1000文字)と、0x3a2=930
までくらいのhexがちょうど100個ずらりと並んだ処理が。
文字列候補とindexかなぁ。でも1500ptでこんなに簡単に出ないよなーと思いつつ、試してみる。
data = "s}yvzezqr_6x45jx2yp4d38qq1mvnsl0u7w32lr12gi}t3i5kw0oewkqb_vv6726}}95cmfy_jfgyx25n1e9cuyvsor_0mijcnhoa2kpvdtjd9js2kstbe5}s6zgyil6qxtr}wbol}dzmg3t02466hu1gkpm2xv8u{ryn0s11uzu_426p8k4owb21f3buof6ok{cp9s2s88k3yhzdsq1d2u7n3}9ex}9sly0p0}lp5yxdi7m37_p82o54im1z7bw5u2tu9n2loybmr51jih8lxf7z6n62goh3_63cnnbfczhmsy4pe}ijluq9xbkk4d{c13s5hjkjldeww9z}78oyt1pog5qudz{6fkw_wgon99yc{7v4sakj6pddk5i1c_1g74e_xwivk7mmbm16it6zxfc1y6sdz{0zrmuvysbl}pmw8z6jb8ejmrqknxbu5w4sv542plnzs8_}znyq6b6x67ar0lsq04qu742uenp4ufoxz7ir8gzohi352}7{9hk{yu4_zbj7gmvl{c_24weh8rwxp_24dhp{giv9k}gz840uezqk9s}qxi{2u2lbbt4i}kq8gomrqewvrj65dgwaoitc99yh4jest6sccnz2wlgmap6f9k04lhanc3wmgpj6xawln_jce6c6vfttu{zws4odom7{h5hewr_{5}6fty4a14ar64q1vvg0s28zsik}nhpmw}j92s42k}zzxx0bn7cddk70iw4{f8wqguyj6a58s0u2}xzwh{0vdawdge8n88j6ms8uvt_r4hezvei3u2k179tlepun{c1l02_e92ijk9xx0o_a8gwnmp1jr9gtk2{cq7qnmrphvyecps}63cqvxcy{i5}d2r1r{rg1n}nufm7sue378uwdqe9ezscxoq90nme76}jx4}}b8ahe_paby2qxqwop63kc6eujs7}f90pkkiddlvfobb24wj52wzu2cnhoa_p4jjw4nh9kr5gif04ojbh1e_eec12" key = [0x1f0, 0x192, 0x322, 0xe4, 0x2f6, 0x2f4, 0x276, 0x27a, 0x2d6, 0xce, 0x8e, 0x33d, 0x1cb, 0xd3, 0x126, 0x22a, 0x125, 0x2ad, 0x1ab, 0x274, 0x117, 0x3a2, 0x1cb, 0x161, 0xfb, 0x28a, 0xa9, 0x216, 0x142, 0x2f, 0x21a, 0x325, 0x216, 0x164, 0x1e4, 0x1b9, 0x2df, 0x1e9, 0x3d, 0x1fe, 0x2d3, 0x1a1, 0x97, 0xaa, 0x123, 0x2d8, 0x184, 0x2d7, 0x90, 0x14, 0xd9, 0x5b, 0x346, 0x25c, 0x1f7, 0x1b6, 0xba, 0x1bd, 0x204, 0xf8, 0x135, 0x14c, 0xb3, 0x35b, 0xe9, 9, 0x1c3, 0x333, 0x3a1, 0xce, 0x2f7, 0x4f, 0x374, 0x164, 0xb8, 0x2c1, 0x1cb, 0x36f, 0x62, 0x123, 0x395, 0x4f, 0x12e, 0x1bd, 0x208, 0x142, 0xef, 0x1cb, 0x368, 0x2ee, 0xd, 0x28a, 0x3e2, 0x388, 0x39a, 0x3a5, 0xf2, 0xe5, 0x2f7, 0xe6] flag = '' for k in key: flag += data[k] print(flag)
実行結果
$ python solve.py rtcp{wh37h3r_1n4n1m473_f16ur35_0r_un4u7h0r1z3d_c0d3_7h3r35_4lw4y5_4_6h057_1n_7h3_5y573m_1056_726_00}
えー出た。びっくり。