PE 文件中的 .00cfg 部分

逆向工程 聚乙烯 视窗 10 pe32 x86-64
2021-07-04 09:43:41

.00cfgVisual Studio 2017 添加到 PE32+ 二进制文件(用于 x64 版本)的那个部分是什么我假设它代表“控制流防护”部分。它相对较小,大部分是空的:

在此处输入图片说明

知道其中的数据布局是什么吗?

2个回答

Windows 加载程序不关心节名称,因此名称并不重要,但通常此节包含指向间接调用保护检查 ( ___guard_check_icall_fptr)的指针指向它的指针存储在加载配置目录GuardCFCheckFunctionPointer字段中

我猜在较新的文件中它可能包含一些额外的指针(见下文)。零可能只是填充到默认部分对齐(512 或 1024 字节,不确定哪个)。

PS找到了一个最近的x64 PE,有更多的指针。显然以下是 32 字节部分的完整布局:

 __guard_check_icall_fptr       dq offset _guard_check_icall_nop
 __guard_dispatch_icall_fptr    dq offset _guard_dispatch_icall_nop
 __guard_ss_verify_failure_fptr dq offset __guard_ss_verify_failure_default
 __guard_ss_verify_sp_fptr      dq offset __guard_ss_verify_sp_default

前两个指针是Control Flow Guard实现的一部分,另外两个来自现已弃用的Return Flow Guard所有四个都由加载配置目录中的字段引用,即理论上它们不必按此顺序排列,甚至不必放在一起。

我在本节看到的最有用的参考资料是在这个Adobe 源评论中:

//
// Allocate xyz in the .00cfg so that it is implicitly merged into the 
// import section of the binary (which is read-only).
// Indirect calls using this pointer do not have the guard check function,
// and so will not fail the CFG check.
//

该代码似乎将以下数据添加到该部分(假设为 x64):

8 byte address the function
4 byte boolean (speculation) whether or not indirect calls should be verified.
4 byte boolean (speculation) whether or not the function pointer is valid.

不过,我还没有看到有关该部分的任何官方文档。