From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:PE (Portable Executable)" |
|---|
| claim | "The Authenticode digest of a PE file skips the optional-header CheckSum (4 bytes at e_lfanew+88), the security directory entry (8 bytes at e_lfanew+152 in PE32, +168 in PE32+) and the certificate table; everything else, including any overlay before the table, is hashed in file order. osslsigncode only recognizes a certificate table that ends exactly at the end of the file (offset + size == file size); otherwise it warns, treats the file as unsigned and hashes up to the end of the file." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:PE (Portable Executable)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "computing or verifying the SpcIndirectDataContent messageDigest of a PE file" |
|---|
| effect | "hash(file[0 : e_lfanew+88] + file[e_lfanew+92 : e_lfanew+152+16*pe32plus] + file[e_lfanew+160+16*pe32plus : start of certificate table]); an unsigned file is zero padded to a multiple of 8 bytes" |
|---|
| condition | "signed or about to be signed PE file" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "digest set-up: writes header_size+88 bytes, skips 4 (CheckSum), writes 60 + pe32plus*16 bytes, skips 8 (security directory entry), hashes the rest up to sigpos; pads unsigned files to 8" |
|---|
| repo | "https://github.com/mtrojnar/osslsigncode" |
|---|
| commit | "868d6e95c603a8057e89336f12fe12b5d2258e00" |
|---|
| path | "pe.c" |
|---|
| lines | "770-830" |
|---|
|
| type | "source" |
|---|
| detail | "Read the header parse: a security directory whose offset+size is not the file size is ignored (sigpos = 0, warning 'Ignoring PE signature not at the end of the file'); the digest then runs to fileend." |
|---|
| repo | "https://github.com/mtrojnar/osslsigncode" |
|---|
| commit | "868d6e95c603a8057e89336f12fe12b5d2258e00" |
|---|
| path | "pe.c" |
|---|
| lines | "575-584, 778-820" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Authenticode digest exclusions" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T08:09:43.100Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:38:56.759Z" |
|---|
| result | "confirmed" |
|---|
| method | "Fetched pe.c at osslsigncode 868d6e95c603 and read pe_ctx_get (lines 520-585: checksum at header_size+88, security directory at +152 (+16 for PE32+), the 'Ignoring PE signature not at the end of the file' condition sigpos+siglen != filesize) and pe_digest_calc_bio (765-815: header_size+88 bytes, skip 4, 60+16*pe32plus bytes, skip 8, hash to sigpos or fileend, zero pad unsigned files to 8). Statements are about osslsigncode's implementation." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T04:48:46.619Z" |
|---|
| summary | "Add the condition on the certificate table position: osslsigncode ignores a table that does not end at the end of the file and hashes the whole file. Read pe.c 528-600 and 778-830." |
|---|
| changed | |
|---|
|
|
|---|