Skip to content

Instantly share code, notes, and snippets.

@kbutti
Last active May 2, 2019 12:56
Show Gist options
  • Select an option

  • Save kbutti/b9cd6f669364e7cb0c95 to your computer and use it in GitHub Desktop.

Select an option

Save kbutti/b9cd6f669364e7cb0c95 to your computer and use it in GitHub Desktop.
セキュリティ・キャンプ全国大会2015 応募用紙 選択問題11 解析手順、および解析対象のファイルを出力するプログラム
// セキュリティ・キャンプ全国大会2015 応募用紙
// 選択問題11「下記バイナリを解析し、判明した情報を自由に記述してください」から引用
// https://www.ipa.go.jp/files/000045804.txt
// 解析手順
//
// g++ bin2file.cpp && a.exe
//
// file q11.bin
// => q11.bin: tcpdump capture file (little-endian) - version 2.4 (Ethernet, capture length 262144)
// => パケットキャプチャーファイルだと分かる
//
// Wireshark で開く。SSL の部分が「TLSv1.2 Record Layer: Heartbeat Request」であると分かる
// SSL & ハートビートというキーワードから、Heartbleed 脆弱性を突いた攻撃だと推測する
//
// 実際 Payload は4バイトしかないのに、Payload Lengh が3835バイトと異常に長い
//
// 推測の裏付けが取れました
//
// 参考: http://qiita.com/maueki/items/69d358d207eb62a2d321
// 以下は与えられたバイナリをファイルに出力するプログラムです。
#include <stdio.h>
static char bin[] = {
0xD4, 0xC3, 0xB2, 0xA1, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x88, 0xEB, 0x40, 0x54, 0xA2, 0xBE, 0x09, 0x00, \
0x52, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x11, 0x11, \
0x11, 0x11, 0x11, 0x11, 0x08, 0x00, 0x45, 0x00, 0x00, 0x44, 0x1A, 0xBD, 0x40, 0x00, 0x80, 0x06, \
0x3A, 0x24, 0xC0, 0xA8, 0x92, 0x01, 0xC0, 0xA8, 0x92, 0x80, 0x10, 0x26, 0x01, 0xBB, 0x86, 0x14, \
0x7E, 0x80, 0x08, 0xB3, 0xC8, 0x21, 0x50, 0x18, 0x00, 0xFC, 0x0D, 0x0E, 0x00, 0x00, 0x18, 0x03, \
0x03, 0x00, 0x17, 0x01, 0x0E, 0xFB, 0x06, 0xF6, 0xCD, 0xA3, 0x69, 0xDC, 0xCA, 0x0B, 0x99, 0xFF, \
0x1D, 0x26, 0x09, 0xE1, 0x52, 0x8F, 0x71, 0x77, 0x45, 0xFA };
int main(int, char**)
{
FILE* f;
f = fopen("q11.bin", "wb");
if (! f ) { return -1; }
fwrite(bin, sizeof(char), sizeof(bin), f);
fclose(f);
return 0;
}
@kbutti
Copy link
Author

kbutti commented May 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment