google / google/authenticode-rs

Verify cryptographic binding of authenticated attributes to encapsulated content

Open
#261 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
36
Forks
17
PR merge metrics
No merged PRs in 30d

Description

## Description
In `AuthenticodeSignature::from_bytes`, when `signer_info.signed_attrs` is present, the parser checks for the existence of `ID_MESSAGE_DIGEST`. However, it fails to validate that the actual octet string value of this attribute matches the raw hash of the encapsulated content (`econtent` or `SpcIndirectDataContent`).

A malformed PE file could contain a completely valid signature over its authenticated attributes block but point to an unlinked or spoofed `SpcIndirectDataContent` structure, breaking downstream tool assumptions (e.g., in `authenticode-tool`).

## Expected Behavior
The parser should extract the message digest from `signed_attrs`, compute the expected digest of the raw `econtent` dynamically based on the signer's digest algorithm (SHA-1 or SHA-256), and verify that they match. If they don't match, it should return `MessageDigestMismatch`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.