executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
re-imports导入导出表与库指纹:IAT/EAT、DLL/so 指纹、FLIRT 思路。 触发词:导入表、IAT、库指纹、链接了哪些库
Independent GitHub snapshot · Automated classification · Original documentation governs
参考 [[re-analyze/platform-tips]]——导入表分析为静态步骤,免沙箱;涉及运行(验证动态解析 API)按最高原则进沙箱。
apt install binutils / dnf install binutils / pacman -S binutilsbrew install binutils(gobjdump);Mach-O 用 otool -L + nm -uobjdump -Vpip install pefilepython3 -c "import pefile; print(pefile.__version__)"rizin -v 验证choco install radare2 作兼容(命令见下)rz-bin -Vgit clone https://github.com/nneonneo/ghidra_flirt && cd ghidra_flirt && make(需 Ghidra 已装,见 [[re-ghidra]])列出导入函数:
objdump -p sample.exe | grep 'DLL Name' -A3 | head -30
import pefile
pe = pefile.PE('sample.exe')
for e in pe.DIRECTORY_ENTRY_IMPORT:
print(e.dll, [i.name for i in e.imports if i.name][:15])
objdump -T sample | grep UND # 未定义符号 = 导入
readelf -s sample | grep -i ' UND '
otool -L sample # 依赖 dylib 列表
nm -u sample # 未定义符号 = 导入
按导入特征匹配库/编译器(FLIRT 思路):
File > Load file > FLIRT signature file...(自带 sig 目录)自动标注库函数;Ghidra 用 ghidra_flirt 插件(工具准备)readelf -s sample | grep -c '' 配合 strings sample | grep -E 'GLIBC_[0-9.]+'(GLIBC 符号版本号);strings libc.so.6 | grep -m1 version 对运行库侧runtime.main / go1.2x 串)、Rust(_ZN/__rust_*)、C++(_Z mangled)、Delphi(@System@)、.NET(mscoree + metadata)定位可疑导入:
OpenProcess + VirtualAllocEx + WriteProcessMemory + CreateRemoteThread(kernel32);NtCreateThreadEx(ntdll)WSAStartup/socket/connect/HttpSendRequestA/WinHttpOpenCryptEncrypt/CryptDecrypt/BCryptEncrypt/CryptExportKey(导出密钥)IsDebuggerPresent/NtQueryInformationProcess/OutputDebugStringA(异常触发检测)ptrace/socket/execve/dlopen/fork;Mach-O 侧: task_for_pid/_dyld_*导出表分析(插件/服务类样本):
objdump -p sample.dll | grep -A30 'Export Table'
import pefile
pe = pefile.PE('sample.dll')
for exp in pe.DIRECTORY_ENTRY_EXPORT.symbols:
print(hex(exp.address), exp.name)
.so: readelf -s sample.so | grep -v UND | grep FUNC(导出的全局函数)nm -gU sample.dylib对照系统库验证(判断是否系统 API 混入可疑参数):
strings sample.exe | grep -iE '\.dll|\.so|\.dylib' # 附加库路径线索
GetProcAddress/dlopen+dlsym 运行时才解析,静态导入表查不到——配合 [[re-tracing]] 观察go1.21、OpenSSL 3.0.x)在字符串里.init_array/TLS 回调)在入口之前覆写 GOT/IAT 条目(如 strcmp@GOT)装 hook,静态视图看不到;对策——导入结论与运行内存视图对照([[re-memdump]]/[[re-tracing]]),样本带初始化回调时先把回调列出来再下结论imphash(导入函数归一化后哈希)做指纹;注意 IAT 被壳接管的样本 imphash 失真,先脱壳再算