ファイル breakRAID.tar.gz が与えられた。
これを展開すると、ファイル disk00、disk01、disk02 が得られた。
disk00 は、全部のバイトが0x00だった。
disk01 にstringsコマンドをかけると、IHDRなどのPNGのチャンク名が出てきた。
disk02 にstringsコマンドをかけると、PNGのチャンク名に加え、01.png ~ 18.png のファイル名と思われる文字列が出てきた。
ファイルが3個あるということは、使われているディスクが3台であることを表していると予想できる。
とりあえず、以下を参照してRAIDの種類の特定を試みた。
A file breakRAID.tar.gz was given.
Files disk00, disk01, and disk02 are extracted from this file.
All bytes of disk00 were 0x00.
Applying the strings command to disk01 yielded PNG chunk names like IHDR.
Applying the strings command to disk01 yielded not only PNG chunk names but also strings from 01.png to 18.png that look like names of files.
I guessed that having 3 files means that 3 disks are used.
To begin with, I tried to determine which kind of RAID is used referring this:
RAID 0 は、耐障害性が無いため今回の問題には適さなそうである。
RAID 1 は複数のディスクに同じ内容を書き込むが、今回はdisk01とdisk02の内容が異なるので適さなそうである。
RAID 2 は最低5台のディスクを必要とするが、今回は3台しか無いので適さなそうである。
RAID 3、RAID 4、RAID 5 は3台のディスクで構築でき、今回の条件と矛盾しなそうである。
RAID 6 は最低4台のディスクを必要とするが、今回は3台しか無いので適さなそうである。
したがって、今回使われているのは RAID 3、RAID 4、RAID 5 のどれかであると考えられる。
これらの方式ではXORを用いるようなので、とりあえず以下のプログラムで disk01 と disk02 のXORをとり、disk-xored とした。
RAID 0 doesn't look good for this challenge because it has no fault tolerance.
RAID 1 doesn't fit because it should write the same data to multiple disks while data in disk01 and disk02 differ.
RAID 2 doesn't fit because it requires at least 5 disks while there are only 3.
RAID 3, RAID 4, RAID 5 can be constructed using 3 disks and it looks good for this challenge.
RAID 6 doesn't fit becaseu it requires at least 4 disks while there are only 3.
In conclusion, one of RAID 3, RAID 4, or RAID 5 should be used in this challenge.
Since exclusive-or is used in these methods, so I performed exclusive-or of disk01 and disk02 using this program and saved the result to disk-xored.
得られたファイル群からバイナリエディタで文字列 IHDR および IEND を探すと、以下の位置に見つかった。
I searched for strings IHDR and IEND from the files using a binary editor, and found at these positions:
IHDR および IEND の位置
The places of IHDR and IEND in the files
同じ位置のものを除くと、IHDR と IEND がそれぞれ18個ずつ見つかった。
これは、ファイル名と思われる文字列 01.png ~ 18.png に対応していそうである。
次に、以下のプログラムを用い、各ファイル中の文字列 IHDR、IDAT、IEND の配置を調べた。
Removing occurances at the same position, I found 18 occurancees of each of IHDR and IEND.
This looks matching with the strings that looks names of files 01.png and 18.png.
After that, I used this program to see places of strings IHDR, IDAT, and IEND in each files.
すると、画像全体が埋め込まれていそうな部分が、重複を除いて以下の16箇所あった。
As a result, I found these 16 places (duplicates are excluced) that seem the entire images are embed:
また、画像の一部が埋め込まれていそうな部分が、重複を除いて以下の4箇所あった。
Also I found these 4 places (duplicates are excluced) that seem parts of image are embed:
これらを踏まえ、以下のプログラムで画像データを取り出した。
画像の一部が埋め込まれていそうな部分については、周辺を調べ、データが 00 ばかりになる手前までの部分を抽出対象とした。
Based on these findings, I used this program to extract the image data.
I decided to investigate data near there and extract data before being filled up with 00 for the places with parts of images.
以下が、抽出対象を指定するこのプログラムの入力である。
This is the input for this program to specify what to extract:
抽出結果のうち 0427f00c.png と 04200000.png を結合して 0427f00c-04200000.png を、
0616500c.png と 06100000.png を結合して 0616500c-06100000.png を作成した。
その結果、以下の画像ファイル群が得られた。
I concatenated 0427f00c.png and 04200000.png to create 0427f00c-04200000.png,
and concatenated 0616500c.png and 06100000.png to create 0616500c-06100000.png.
As a result, I obtained these image files:
これで18個の画像ファイルが得られたが、順番がバラバラなようであり、
どの順番で 01.png ~ 18.png に対応しているかを調べないといけなそうである。
そこで、disk02 内の文字列 01.png の周辺を調べると、以下のように連番が並んでいた。
Now I have 18 image files, but their order looks shuffled and finding which images correspond to which of 01.png to 18.png looks required.
I investigated around the string 01.png in disk02, finding that there are some serial numbers like this:
disk02 内の文字列 01.png の周辺
Around the string 01.png in the file disk02
そこで、disk02 から F が書かれているファイル 00d1b00c.png のサイズ 133326 (4バイト、リトルエンディアン) を検索すると、0x021d584 などに見つかった。
さらに、0x021d584 から 0x80 バイトおきに他のファイルのサイズを表すデータもあった。
ここで示されているファイルサイズの順番にファイルに書かれている文字を並べると、flagが得られた。
(同じファイルサイズのファイルもあったが、それらは書かれている文字も同じようだった)
I searched for ths size of the file 00d1b00c.png, which has the character F, 133326 (4 bytes, little endian) and it was found at 0x021d584 and some other places.
Also, there are data that represents sizes of other files from 0x021d584 at the interval of 0x80 bytes.
I obtained the flag by ordering the characters on the files according to the order of sizes recorded here.
(There are files with the same sizes, but it looked characters written there are also same.)