画像の中に埋め込まれたメッセージを解読する問題です。Question 2
You can(t) see me (Score 100)
On the wonderland of britannia, there are two kinds of dragons Red and Black
Master Zero is the commander of blacks and all the black dragons support him.The Red dragons' leader Amiya thinks that the Reds are the best among dragons and blacks are nothing but useless.
So they want to teach a lesson to black dragons.They encoded a message in this image and sent it to them asking them to decode it. Can they see the message?
Tags: #stego #reversing
このPNG画像「color.png」は幅7×高さ200のサイズで、赤と黒のピクセルから構成されています。幅が7ドットですので、赤黒のピクセルで1,0のビット、1ラインで1文字のASCIIコードを表していると予想します。
ためしに、最初の数ラインについて、赤(1)、黒(0)として解読してみます。

1行目 0110011=33 34行目までですが、全て印字可能文字になりました。それでは、200行すべてをASCIIコードに変換するRubyプログラムを書いてみます。画像のピクセルを取得するのに、RMagickライブラリを使っています。
2行目 1111000=78 x
3行目 1011000=58 X
4行目 1001011=4B K
require "RMagick"プログラムを実行すると、次の文字列を得ることができます。
include Magick
def get_rgb_arry(file)
img = ImageList.new(file)
str = ""
for y in 0...img.rows
ch = 0
for x in 0...img.columns
src = img.pixel_color(x, y) # 元画像のピクセルを取得
ch = ch << 1
if src.red > 0 then
ch += 1
end
end
str = str + ch.chr
end
return str
end
pic1 = "color.png"
print get_rgb_arry(pic1)
3xXKkFstTUpsG2IFDirE6xDrcAF8DSx4iWxd5f9IQ9T205izN8lS2MQUlsF11gT4TFXHHlLHVHprNTtrh6lURfdUW7Lpuzgu1VKzwb1bg1oq6Ae3GnykkLZZsnze3HVLxHlfCYtzyrcV2Oxp0Gb0Z2ELphR4Oxo7TyvHCuWKWlN8t8KIfHysZK7jBNPu6wRVEUPIwVrasubmitすると、見事正解でした。
ということで、フラグは、
3xXKkFstTUpsG2IFDirE6xDrcAF8DSx4iWxd5f9IQ9T205izN8lS2MQUlsF11gT4TFXHHlLHVHprNTtrh6lURfdUW7Lpuzgu1VKzwb1bg1oq6Ae3GnykkLZZsnze3HVLxHlfCYtzyrcV2Oxp0Gb0Z2ELphR4Oxo7TyvHCuWKWlN8t8KIfHysZK7jBNPu6wRVEUPIwVraです。










