以下のファイルがあります。どういうファイルか知りたいとき、何のコマンドを使いますか。
$ 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...")$
$ ./crackme
enter the passcode: thisisthepasscode You are correct!!! :-)$
owari
Use a spacebar or arrow keys to navigate