【IDA PRO】程式解構 - Hello World


前言

這篇文章紀錄 IDA PRO 軟體,分析 Hello World 的過程。

在本練習中,我們將對 Hello.exe 檔案進行分析、修改的行為。
⚙️ Lab Environment:
  • Windows 11 ( IDA PRO )

🛠️ Static Analysis Tools:
  • IDA PRO
  • 非必須 Docker ( 準備 hello world 代碼 )


1. 📝 Hello World !! 程序

  • 建立 hello.c 檔案
1
2
3
4
5
6
#include <stdio.h>

int main() {
printf("Hello, World!!");
return 0;
}
  • 使用 Docker 指令

docker 編譯

1
2
3
4
5
6
7
8
9
# 使用 Docker 對該資料進行映射,映射後資料夾全部內容都會被拉進容器內
docker run --rm -it -v .:/work -w /work gcc:latest bash

# 在容器內安裝 MinGW
apt update && apt install -y mingw-w64

# 對 hello.c 進行編譯
x86_64-w64-mingw32-gcc hello.c -o hello.exe


  • 查看執行結果是否正常

Hello World




2. 📝 IDA PRO Analysis

  • 使用 IDA PRO 打開 exe

Open IDA


  • 至 Strings 找到 Hello World 字樣 ( Shift + F12 )

IDA Strings

Found Hello Word

找到字樣後點選進去,選擇 hex dump

選擇編輯,並將替換的編碼輸入進去

1
2
# IDA PRO Test
49 44 41 20 50 52 4F 20 54 65 73 74 00

確認文字變更後,儲存並測試

🚀 確認無誤 🚀




💡 結論

  • 透過本次的練習,我們成功利用 IDA Pro 找到並修改可執行檔案 (hello.exe) 內的字串,將 “Hello, World!” 替換為 “IDA PRO Test”。


🔗 參考來源