Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.

For the best experience please use the latest Chrome, Safari or Firefox browser.

Reverse Engineering

Dennis Gosnell

...

クイズ対決!!

問①

以下のファイルがあります。どういうファイルか知りたいとき、何のコマンドを使いますか。

$ ls -l crackme
-rwx------ 1 me user 8293 May 29 crackme
$

答①

file

$ file crackme
crackme: ELF 64-bit LSB executable x86-64,
version 1 (SYSV), dynamically linked (uses
shared libs), for GNU/Linux 2.6.26, not
stripped
$

実行してみる

$ ./crackme
enter the passcode: 

パスコードを入れてみる

$ ./crackme
enter the passcode: hogehogehoge
Incorrect... :-(
$

問②

もしかして、求められているパスコードが、この実行可能ファイル内で定義されている文字列の可能性はある。

実行可能ファイル内の表示可能な文字列を表示するコマンドは何ですか?

答②

strings

$ strings crackme
/lib64/ld-linux-x86-64.so.2
DD[u
__gmon_start__
fflush
...
enter the passcode:
thisisthepasscode
You are correct!!! :-)
Incorrect... :-(
$

問題③

もしかして、入力するパスコードが内部で定義されているパスコードと比較されている可能性はある。

普段は、glibcで定義されているstrcmpを使って文字列を比較する。

共有ライブラリ(例えばglibc)の関数呼び出しをトレースできるコマンドは何ですか?

答③

ltrace

$ ltrace crackme
fwrite("enter passcode: ", 1, 20, 0x7f123)
fflush(0x7f123)
fgets("hogehoge", 831250, 0x7fff1)
strchr("hogehoge\n", '\n')
strcmp("hogehoge", "thisisthepasscode")
puts("Incorrect...")
$

thisisthepasscode

$ ./crackme
enter the passcode: thisisthepasscode
You are correct!!! :-)
$

owari

Use a spacebar or arrow keys to navigate