School CTF 2015 Writeup

この大会は2015/11/4 15:00(JST)~2015/11/4 20:00(JST)に開催されました。
5時間という短期決戦の上、業務時間中なので、仕事の合間を縫って何とか2時間ほど解く時間が取れました。
今回も個人で参戦。結果は500点でNon School Teamsの中で141位でした。
参加チームはSchool Teamsが127チームで、Non School Teamsが447チーム。
この短時間のわりにはできたかなと思います。
解けた問題をWriteupとして書いておきます。

Pure Color (stegano 100)

一見白一色のpng形式の画像ファイルが与えられている。
まず、Stegsolve.jarでポチポチっとビット演算の結果を表示させる。
blue plane 0でフラグが表示された。

true_steganographers_doesnt_need_any_tools

f:id:satou-y:20151105225544p:plain

Hunger games (web 100)

サルが餌をくれと言っているページ。
f:id:satou-y:20151105230100p:plain

適当にチェックを入れてFeed!ボタンを押すと、バナナをくれと言ってくる。
f:id:satou-y:20151105230227p:plain

バナナは選択肢にないので、Fiddlerを使ってリクエストを横取りし、
data=bananaに書き換え、継続すると、フラグが表示された。

l375_$7ar7_w3b_h4ck5

f:id:satou-y:20151105230745p:plain

Lazy cryptanalyst (crypto 100)

この暗号文を復号する問題。

bsxz xz om rxuvi. bsiri qri oqym gbsirz 
vxji xb, whb bsxz gyi xz oxyi. om rxuvi xz 
om wizb urxiye. xb xz om vxui. x ohzb 
oqzbir xb qz x ohzb oqzbir om vxui. 
fxbsghb oi, om rxuvi xz hzivizz. fxbsghb 
om rxuvi, x qo hzivizz. x ohzb uxri om 
rxuvi brhi. x ohzb zsggb zbrqxlsbir bsqy 
om iyiom, fsg xz brmxyl bg jxvv oi. x ohzb 
zsggb sxo wiugri si zsggbz oi. x fxvv. 
wiugri lge x zfiqr bsxz kriie: om rxuvi 
qye omzivu qri eiuiyeirz gu om kghybrm, fi 
qri bsi oqzbirz gu ghr iyiom, fi qri bsi 
zqpxgrz gu om vxui. zg wi xb, hybxv bsiri 
xz yg iyiom, whb ciqki. uvql xz q eqm 
fxbsghb wvgge xz vxji q eqm fxbsghb 
zhyzsxyi. qoiy.

こんな画像も与えられるている。
f:id:satou-y:20151106202341j:plain

この画像からも換字暗号であることは明らか。
最初は手で一語一語変換していったが、時間がかかるので、quipquipで復号する。
この結果、このような文になって、最後の方にフラグが書いてある。

this is my rifle. there are many others 
like it, but this one is mine. my rifle is 
my best friend. it is my life. i must 
master it as i must master my life. 
without me, my rifle is useless. without 
my rifle, i am useless. i must fire my 
rifle true. i must shoot straighter than 
my enemy, who is trying to kill me. i must 
shoot him before he shoots me. i will. 
before god i swear this creed: my rifle 
and myself are defenders of my country, we 
are the masters of our enemy, we are the 
saviors of my life. so be it, until there 
is no enemy, but peace. flag is a day 
without blood is like a day without 
sunshine. amen.
a day without blood is like a day without sunshine

Meaningless Text (stegao 200)

長文のhtmlファイルが与えられている。
ソースを見ると<em>タグで囲まれている部分と大量の<e>のタグで囲まれているzeroとoneの文字があるのがわかる。
<em>タグは数えられる程度なので、順に読むとこのような文になる。

flag is not this line but you think right way

予想はしていたが、これはフラグには結びつかなかった。
たぶん同じように<e>タグの方で読み込む必要があると思い、プログラムを組むことにした。
xmlフォーマットとして読み込むようにするためには、htmlファイルの<meta>タグの部分のみxmlのルールを満たしていないため、その対応をした上で次のようなプログラムを組んでみた。

import xml.etree.ElementTree as ET

tree = ET.parse('task12_mod.html')
root = tree.getroot()

list = []
elelist= root.findall(".//e")
for ele in elelist:
    if ele.text == 'zero':
        list.append('0')
    else:
        list.append('1')

result = ""
code = ""
for i in xrange(len(list)):
    code += list[i]
    if i % 8 == 7:
        result += chr(int(code, 2))
        code = ""

print result

実行するとフラグが表示された。

flag_is_this_is_a_simple_stego