utctf 2021 writeup
こんにちは!Ken.Sです!
今回はutctfのwriteupです
m1z0r3は9779ptで72位でした
Beginner
Cipher Gauntlet
Can you make it through all of the encodings and ciphers?
ファイル:secret.txt
中を見ると8bitの整数がたくさんあるので、まあASCIIだろうとchrしてみる。
そうすると以下のような文章が!
Uh-oh, looks like we have another block of text, with some sort of special encoding. Can you figure out what this encoding is? (hint: if you look carefully, you'll notice that there only characters present are A-Z, a-z, 0-9, and sometimes / and +. See if you can find an encoding that looks like this one.)
TmV3IGNoYWxsZW5nZSEgQ2FuIHlvdSBmaWd1cmUgb3V0IHdoYXQncyBnb2luZyBvbiBoZXJlPyBJdCBsb29rcyBsaWtlIHRoZSBsZXR0ZXJzIGFyZSBzaGlmdGVkIGJ5IHNvbWUgY29uc3RhbnQuIChoaW50OiB5b3UgbWlnaHQgd2FudCB0byBzdGFydCBsb29raW5nIHVwIFJvbWFuIHBlb3BsZSkuCm15eHFia2Rldmtkc3l4YyEgaXllIHJrZm8gcHN4c2Nyb24gZHJvIGxvcXN4eG9iIG1iaXpkeXFia3pyaSBtcmt2dm94cW8uIHJvYm8gc2MgayBwdmtxIHB5YiBrdnYgaXllYiBya2JuIG9wcHliZGM6IGVkcHZrcXt4eWdfaXllYm9fenZraXN4cV9nc2RyX21iaXpkeX0uIGl5ZSBnc3Z2IHBzeG4gZHJrZCBrIHZ5ZCB5cCBtYml6ZHlxYmt6cmkgc2MgbGVzdm5zeHEgeXBwIGRyc2MgY3liZCB5cCBsa2NzbSB1eHlndm9ucW8sIGt4biBzZCBib2t2dmkgc2MgeHlkIGN5IGxrbiBrcGRvYiBrdnYuIHJ5em8gaXllIG94dHlpb24gZHJvIG1ya3Z2b3hxbyE=
後半は明らかにbase64ですね、デコードしてみましょう。
New challenge! Can you figure out what's going on here? It looks like the letters are shifted by some constant. (hint: you might want to start looking up Roman people).
myxqbkdevkdsyxc! iye rkfo psxscron dro loqsxxob mbizdyqbkzri mrkvvoxqo. robo sc k pvkq pyb kvv iyeb rkbn oppybdc: edpvkq{xyg_iyebo_zvkisxq_gsdr_mbizdy}. iye gsvv psxn drkd k vyd yp mbizdyqbkzri sc lesvnsxq ypp drsc cybd yp lkcsm uxygvonqo, kxn sd bokvvi sc xyd cy lkn kpdob kvv. ryzo iye oxtyion dro mrkvvoxqo!
rot13ぽい文章が出てきました。途中にはflagがありそうですし、最初の単語はcongratulations! のようですね。
rot13しても文章にならない…。最初の文字がzになったのでもう3つシフトしてみたら(つまり上記の文をrot16したら)flagがでました。
congratulations! you have finished the beginner cryptography challenge. here is a flag for all your hard efforts: utflag{now_youre_playing_with_crypto}. you will find that a lot of cryptography is building off this sort of basic knowledge, and it really is not so bad after all. hope you enjoyed the challenge!
utflag{now_youre_playing_with_crypto}
Sizzling Bacon
My buddy Francis is really into Bacon. He loves it so much that he gave me this encoded bacon-themed flag (he said he was inspired by the sound of sizzling bacon).
sSsSSsSSssSSsSsSsSssSSSSSSSssS{SSSsSsSSSsSsSSSsSSsSSssssssSSSSSSSsSSSSSSSSsSSsssSSssSsSSSsSSsSSSSssssSSsssSSsSSsSSSs}
とりあえず{}が見えるので換字暗号だろうと予想。{の文字の前には30文字あり今回のフォーマットはutflagなので、暗号文5文字が平文1文字になるのだろう。暗号文を5文字区切りで見たら平文aに該当しそうな暗号文21~25文字目がSSSSSでした。Sが0でsが1となる2進数でord('a')+(その2進数)とすれば解けるのでは?となりました。f,gに該当する部分もこの考え方で齟齬はありませんでした。あとはこれに沿って復号します。
それにしてもなぜベーコン?ベーコンを炒める音でこの暗号を思いついたのはなぜ?
追記:こんな暗号があるんですね
utflag{crispybaconcipher}
Various Vernacular
This flag was intercepted. wmysau{foeim_Tfusoli}
Unfortunately, it seems to be encrypted. Additional encrypted text was also found.
Hkgxologflutleiaymt xgf Azutgkrftmtf ltmntf ERW wfr ELW wfmtk Rkweq.
HINT : The plaintext may not necessarily be in English.
とりあえずwmysauがutflagなるんだろう。その後は???って感じでした。これが本当にbeginnerか?
ヒントを見ると英文が暗号化されたわけではなさそうなところが、さらに突き放された気分…。
換字式暗号だろうということから、なんとかquipquipというものがあることを思い出し、Cluesにwmysau=utflagと入れたらドイツ語の文章が出てきました(出てきた文をDeepLに入れて判明)。英語以外もやってくれるとかquipquipしゅごい。
あとは辞書を作って完成です。
utflag{nicht_English}
Cryptography
Small P Problem
My buddies Whitfield and Martin were trying to share a secret key between themselves, and I was able to eavesdrop on their conversation. I bet I could probably figure out their shared secret with a little math...
p = 69691
g = 1001A = 17016
B = 47643
Note: submit either the shared secret or the shared secret wrapped in utflag{}
うーん、これはなんだろう。gとpがあるのでElGamalっぽくy=pow(g,x,p)でyがA,Bに該当するんだろうととりあえずxを計算してみたらA,Bともに出てきました。
A = pow(g,12552,p),
B = pow(g,7919,p)
さてここからが分からない。秘密鍵ってこの12552と7919じゃないのか?utflag{125527919}と提出してもincorrectでした。
ここで少しうなって時間かけて、とりあえず上の2問を先に解きました。
自分が知らない暗号方式があるのでは?と、「暗号 g p A B」でググる初心者振り。そしたらDiffie-Hellman鍵共有を見つけてこれだ!!となりました。
知ってました、知ってたんですけどね…。というかあんなググり方でヒットする検索エンジンすごい。
秘密鍵 = pow(g, 12552*7919, p) = 53919
utflag{53919}
illegal Prime
The NSA published the ciphertext from a one-time-pad. Since breaking one-time-pad is so easy, I did it for you.
To avoid legal trouble I can't tell you the key. On an unrelated note I found this really cool prime number.
ファイル:challenge.txt
まずillegal primeってなんだ?ところから入りました。
illegal primeとは、機密情報を含む素数のことです。例えば、100...00(電話番号10桁)00...01のような素数があったとして、私はこんな素数を見つけました!とその素数を公開します。その電話番号を持つ人にとっては迷惑な話です。電話番号以外にも機密情報を公開するのは違法ですが、素数として公開すれば法をかいくぐることができますねというお話です。
この記事が分かりやすくてオススメです。
違法素数を小学生でもわかるように例えで説明する | 数学の星
ということで、challenge.txtのpに情報が隠されているのだろうと踏んで探してみました。結果、long_to_bytes()したらkeyらしきものが見えました。
b'k = 5a0b05d9831438ac8561d2b0a42be1cf5613db21deb9a443e21c4d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f'
このkと与えられたcをどうしたらいいのかで悩み、中断…。k+cとかk-cとか考えてました。この記事のせいだ。
結局kとcのxorをlong_to_bytesでOKでした。悔しい。
utflag{pr1m3_cr1m3s____!!!}
Forensics
SHIFT
I just tried to download this flag, but it looks like the image got messed up in transit...
ファイル:SHIFT.png
解いてる人が多いのとPNGファイルの扱いが苦手なのでやってみました。
画像を見ると、文字が斜めになっていそうな感じです。画像の幅や高さを変えたらできるのかな?とか思っていました。
結局PILの使い方を先輩に教えてもらって、ピクセルを上手くずらすことができました。
画像の下の部分にいくにつれてよりずらすことで、斜めになった文字を直せました。
utflag{not_when_i_shift_into_maximum_overdrive}
OSINT part2
Find the origins of the linked file found in part 1.
HINT : Downloading and uploading the file might give more straight forward results
HINT : The solution involves an everyday tool used to find things.
とりあえずpart1はチームメイトが解いてたので、それを基にやってみました。part1のflagはある方のツイートにあったとのことで、それを見に行きました。すると、そのツイートに対してリプライがあり、画像ファイルがありました。問題文よりこの画像ファイルを発信源を探すのだろうと、画像検索。そしたら一発でした。
utflag{r3v3rs3d_t0_0r1g1nal}
solverなどはこちらです!
次はLINE CTFに参加しようと思います!
それでは!
See you next time!