Rulesページに記載されています。Flag example
Points1 Solves342 CategoryTrivia
- Description
Whats the flag example that describe flag style?

フラグは、
ASIS{_some_l33t_string_l1k3_7hi5_}です。
Rulesページに記載されています。Flag example
Points1 Solves342 CategoryTrivia
- Description
Whats the flag example that describe flag style?
ASIS{_some_l33t_string_l1k3_7hi5_}です。
ダウンロードしたファイルを解凍すると、パケットキャプチャファイル(firtog.pcap)が出来ます。このファイルをWiresharkで開いて、TCPストリームを確認します。このパケットキャプチャファイルには、TCPストリームが0~8まであります。ちなみに下図はTCPストリーム0の画像です。firtog
Points109 Solves45 CategoryForensic
- Description
Obscurity is definitely not security.
0036git-upload-pack /asisPrivRepo.host=198.105.254.11.git upload-packコマンドでは、objectファイルを圧縮したpackfileを送信します。PACKプロトコルについては次のサイトが分かりやすいです。
00c9912ce07cc38a1e1887a5bd2e5215106e5b172b6f HEAD.multi_ack thin-pack side-band side-band-64k ofs-delta shallow no-progress include-tag multi_ack_detailed symref=HEAD:refs/heads/master agent=asisAgent
003f912ce07cc38a1e1887a5bd2e5215106e5b172b6f refs/heads/master
0000
0077want 912ce07cc38a1e1887a5bd2e5215106e5b172b6f multi_ack_detailed side-band-64k thin-pack ofs-delta agent=asisAgent
0032want 912ce07cc38a1e1887a5bd2e5215106e5b172b6f
0000
0009done
0008NAK
0020.Counting objects: 7, done.
004b.Compressing objects: 20% (1/5) Compressing objects: 40% (2/5)
006e.Compressing objects: 60% (3/5) Compressing objects: 80% (4/5) Compressing objects: 100% (5/5)
002c.Compressing objects: 100% (5/5), done.
002b.Total 7 (delta 0), reused 0 (delta 0)
0271.PACK..........x...1n.!..{^.}...e...._Y`9#.p.6..{'Mzw..ft......ErlK(....B.>H.kM5X.....t....\s......bM qK....1.....^...Y.....?^.l.g... 9.h."|X...q.7Uy[4..Tx....p<....<..P.Fn...]&k....K.O...x...;.0.D{.B}HX},)`B..^.....I...&}..)...Wf...9/.Gpqr...qY!...J.8..*|.W.:#.R.w=........6>X..D./..(*.!...C%.t.t....._...u.S}..\:...x..E...100755 flag.py..K..d..........w.xS.100644 readme..w..PL......].(..C.t.+./..x.SV./-..O.../.,....RV...-.IUH*-Q(NM.-JUH.ILWHO.K-J,./RH.b.`.`...7.........b...>..7x...TH..... ..5..x.340031Q(JML.Me......Z.S...}....3.D...v....x...TH...*..,V.......D......T....t........."....|.+M........{%.'.x.........D.
0006..
0000
$ mkdir tmptcpストリーム0のPACKデータを、作成した空のGitリポジトリに取り込みます。
$ cd tmp
$ git init newrepo
Initialized empty Git repository in /(略)/tmp/newrepo/.git/
$ cd newrepo
$ file ../../pack0tcpストリーム1のPACKデータをGitリポジトリに取り込みます。
../../pack0: Git pack, version 2, 7 objects
$ git unpack-objects < ../../pack0
Unpacking objects: 100% (7/7), done.
$ file ../../pack1tcpストリーム2のPACKデータをGitリポジトリに取り込みます。
../../pack1: Git pack, version 2, 3 objects
$ git unpack-objects < ../../pack1
Unpacking objects: 100% (3/3), done.
$ file ../../pack2tcpストリーム4のPACKデータを、Gitリポジトリに取り込みます。
../../pack2: Git pack, version 2, 4 objects
$ git unpack-objects < ../../pack2
Unpacking objects: 100% (4/4), done.
$ file ../../pack4tcpストリーム5のPACKデータを、Gitリポジトリに取り込みます。
../../pack4: Git pack, version 2, 4 objects
$ git unpack-objects < ../../pack4
Unpacking objects: 100% (4/4), done.
$ file ../../pack5tcpストリーム6のPACKデータを、Gitリポジトリに取り込みます。
../../pack5: Git pack, version 2, 4 objects
$ git unpack-objects < ../../pack5
Unpacking objects: 100% (4/4), done.
$ file ../../pack6tcpストリーム7のPACKデータをGitリポジトリに取り込みます。
../../pack6: Git pack, version 2, 3 objects
$ git unpack-objects < ../../pack6
Unpacking objects: 100% (3/3), done.
$ file ../../pack7tcpストリーム8のPACKデータをGitリポジトリに取り込みます。
../../pack7: Git pack, version 2, 4 objects
$ git unpack-objects < ../../pack7
Unpacking objects: 100% (4/4), done.
$ file ../../pack8下図のようにobjectsフォルダの配下にobjectが格納されています。
../../pack8: Git pack, version 2, 4 objects
$ git unpack-objects < ../../pack8
Unpacking objects: 100% (4/4), done.
$ git cat-file -p 922faaf7d9a6f74eb661acc62b93b968ec3f781ftreeオブジェクトの内容を確認します。
tree 628cc247df3210b18bd8c7a07e4d226bda163514
parent f87038d3963f54b9c0e71d14ee6dbab113e42a81
author factoreal <factoreal@asis.io> 1462028513 +0430
committer factoreal <factoreal@asis.io> 1462028513 +0430
a new encrypted flag :P:P
$ git cat-file -p 628cc247df3210b18bd8c7a07e4d226bda163514flag.pyの内容を確認します。
100644 blob 0f0d373a6eee2c165e9d69d001f3db0bb34fde7c flag.py
100644 blob 91d8fd06d858898001c781d9034ce189e0d55ed0 flag.txt
100644 blob 1077a52e504c1ecb8f8dcb105dbe28c51d43a774 readme
$ git cat-file -p 0f0d373a6eee2c165e9d69d001f3db0bb34fde7cflag.txtの内容を確認します。
#!/usr/bin/python
# Simple but secure flag generator for ASIS CTF Quals 2016
from os import urandom
from hashlib import sha1
l = 128
rd = urandom(l)
h = sha1(rd).hexdigest()
flag = 'ASIS{' + h + '}'
print flag
f = open('flag.txt', 'w')
flag_enc = ''
for c in flag:
flag_enc += hex(pow(ord(c), 65537, 143))[2:]
f.write(flag_enc)
f.close()
$ git cat-file -p 91d8fd06d858898001c781d9034ce189e0d55ed0flag.pyの処理内容は、生成した乱数のSHA1ハッシュをASIS{}の形式にしたものがフラグで、そのフラグを1文字ずつpow(べき剰余)を計算し、16進文字にしたものをflag.txtに出力しています。
41608a606a63201245f1020d205f1612147463d85d125c1416635c854c74d172010105c14f8555d125c3c
import string実行すると次の結果が得られます。
for c in string.hexdigits:
print c
print hex(pow(ord(c), 65537, 143))[2:]
$ python test.pyflag.txtの内容に対して、上記の結果を逆に当てはめるとフラグを求めることができます。
0 10
1 45
2 55
3 74
4 d
5 5c
6 20
7 16
8 17
9 12
a f
b 4c
c 63
d 85
e 5f
f 14
A 41
B 42
C 2d
D 8b
E 4b
F 5
41 | 60 | 8a | 60 | 6a | 63 | 20 | 12 | 45 | f | 10 | 20 | d | 20 | 5f | 16 | 12 | 14 | 74 | 63 | d | 85 | d |
A | S | I | S | { | c | 6 | 9 | 1 | a | 0 | 6 | 4 | 6 | e | 7 | 9 | f | 3 | c | 4 | d | 4 |
12 | 5c | 14 | 16 | 63 | 5c | 85 | 4c | 74 | d | 17 | 20 | 10 | 10 | 5c | 14 | f | 85 | 55 | d | 12 | 5c | 3c |
9 | 5 | f | 7 | c | 5 | d | b | 3 | 4 | 8 | 6 | 0 | 0 | 5 | f | a | d | 2 | 4 | 9 | 5 | } |
ASIS{c691a0646e79f3c4d495f7c5db3486005fad2495}です。