0Pricing
Assembly Language & x86 Low-Level Systems Programming · レッスン

トレーシングとフックによる動的解析

静的逆アセンブルの先へ進み、システムコールトレーシング、ライブラリトレーシング、関数フックを使ってプログラムの実行中の動作を観察し、実際の挙動を理解します。

「トレーシングとフックによる動的解析」はCoddyKit上の無料Assembly Language & x86 Low-Level Systems Programmingレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはAssembly Language & x86 Low-Level Systems Programming学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Assembly Language & x86 Low-Level Systems Programmingコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Static vs Dynamic Analysis

Static analysis inspects a binary without running it (disassembly, strings). Dynamic analysis watches the program while it executes, revealing behavior that only appears at runtime, such as decrypted strings or network calls.

Why Dynamic Analysis Wins

Packed or obfuscated binaries hide their logic from a disassembler. But to actually do anything, the code must eventually run real instructions and make real syscalls — and that is exactly what dynamic tools capture.

System Call Tracing with strace

On Linux, strace logs every system call a process makes. It instantly shows files opened, network connections, and arguments passed to the kernel.

strace -f ./target            # follow child processes
strace -e trace=network ./bin # only network syscalls
strace -p 1234                # attach to running PID 1234

Reading strace Output

Each line is a syscall with arguments and return value:

openat(AT_FDCWD, "/etc/passwd", O_RDONLY) = 3

This reveals the program read /etc/passwd and got file descriptor 3 — behavior invisible in static text.

Library Call Tracing with ltrace

ltrace traces calls into shared libraries, like strcmp, malloc, or getenv. This is gold for cracking password checks where the comparison happens in libc.

ltrace ./crackme
# strcmp("hunter2", "letmein") = -1

Function Hooking

Hooking intercepts a function call to inspect or change arguments and return values. You redirect the original function pointer to your own code, do your work, then optionally call the original.

LD_PRELOAD Interception

On Linux you can override any libc function by exporting a replacement in a preloaded shared object. The loader resolves your symbol first.

export LD_PRELOAD=./myhook.so
./target            # calls now route through your hook

A Simple Hook in C

This overrides strcmp to log every comparison, then calls the real one via dlsym(RTLD_NEXT, ...).

#define _GNU_SOURCE
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>
int strcmp(const char *a, const char *b) {
    int (*real)(const char*, const char*) = dlsym(RTLD_NEXT, "strcmp");
    fprintf(stderr, "strcmp: %s vs %s\n", a, b);
    return real(a, b);
}

Hardware and Software Breakpoints

Dynamic debuggers use breakpoints to pause execution. A software breakpoint replaces a byte with 0xCC (INT 3). A hardware breakpoint uses the CPU debug registers DR0-DR3 and can also trip on memory reads/writes.

Instrumentation Frameworks

For heavy automation, frameworks like Frida and Intel Pin inject instrumentation at runtime. Frida lets you script hooks in JavaScript while the target runs — ideal for mobile and live analysis.

Anti-Debugging Awareness

Malware fights back. It may call ptrace(PTRACE_TRACEME) to detect a debugger, check timing, or scan for 0xCC bytes. Recognizing these checks is part of dynamic reverse engineering.

Quick Check

Test your dynamic-analysis knowledge.

Recap

You learned to analyze running programs:

  • Dynamic analysis reveals runtime behavior static tools miss
  • strace traces syscalls; ltrace traces library calls
  • Hooking via LD_PRELOAD or Frida intercepts function calls
  • Breakpoints (INT 3 / debug registers) and anti-debugging tricks shape the work

よくある質問

「トレーシングとフックによる動的解析」レッスンは無料ですか?

はい。「トレーシングとフックによる動的解析」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Assembly Language & x86 Low-Level Systems Programmingコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Assembly Language & x86 Low-Level Systems Programmingコースには全4レッスンが含まれています。

「トレーシングとフックによる動的解析」で何を学びますか?

静的逆アセンブルの先へ進み、システムコールトレーシング、ライブラリトレーシング、関数フックを使ってプログラムの実行中の動作を観察し、実際の挙動を理解します。 ブラウザで直接実行するハンズオンコードでAssembly Language & x86 Low-Level Systems Programmingを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Assembly Language & x86 Low-Level Systems Programmingを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのAssembly Language & x86 Low-Level Systems Programmingは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「トレーシングとフックによる動的解析」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このAssembly Language & x86 Low-Level Systems Programmingレッスンでコードを書いて実行できますか?

はい。すべてのAssembly Language & x86 Low-Level Systems Programmingレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. AssemblyデバッグにGDBを使用する
  2. 逆アセンブルツール入門
  3. リバースエンジニアリングの基礎技法
  4. トレーシングとフックによる動的解析
← Assembly Language & x86 Low-Level Systems Programmingに戻る