我有相关的一些担忧Characteristics标志IMAGE_FILE_SYSTEM的IMAGE_FILE_HEADER结构。
根据所有规范,它说具有此设置的文件是系统文件。但是它并没有阐明System file 的含义,我也检查了System32 中的一堆文件,但没有一个设置了它。
有谁知道这个标志的实际含义(如果它没有被弃用)并且有任何设置了这个标志的真实样本。
我有相关的一些担忧Characteristics标志IMAGE_FILE_SYSTEM的IMAGE_FILE_HEADER结构。
根据所有规范,它说具有此设置的文件是系统文件。但是它并没有阐明System file 的含义,我也检查了System32 中的一堆文件,但没有一个设置了它。
有谁知道这个标志的实际含义(如果它没有被弃用)并且有任何设置了这个标志的真实样本。
根据PeLib项目:
如果文件是驱动程序等系统文件,则设置 IMAGE_FILE_SYSTEM。这不适用于可执行文件;它也没有用于我检查过的所有 NT 驱动程序。
我结合了一个快速的 Powershell 脚本来检查文件是否具有 IMAGE_FILE_SYSTEM 属性:
function isSystemFile([string] $filename)
{
# Get the content of the file, as an array of bytes
$fileBytes = Get-Content $filename -ReadCount 0 -Encoding byte
$IMAGE_FILE_SYSTEM = 0x1000
# The offset of the signature in the file is stored at location 0x3c.
$offsetOfSignature = $fileBytes[0x3c]
$coffHeader = $offsetOfSignature + 4
# The characteristics data are 18 bytes into the COFF header. The BitConverter ## class manages the conversion of the 4 bytes into an integer.
$characteristicsData = [BitConverter]::ToInt32($fileBytes, $coffHeader + 18)
# Check if the data from the file has IMAGE_FILE_SYSTEM flag set
if(($characteristicsData -band $IMAGE_FILE_SYSTEM) -eq $IMAGE_FILE_SYSTEM)
{
Write-Host "File has IMAGE_FILE_SYSTEM attribute"
}
else
{
Write-Host "Nope :-("
}
}
剧本可能不准确,写得真快
可以在此处找到有关系统文件的更多信息。
编辑:我删除了关于系统级标志attrib的部分。感谢@Igor 指出这一点。