Skip to content

reject extra data after the signature in the PE certificate table - #362

Open
itecz26 wants to merge 2 commits into
ebourg:masterfrom
itecz26:pe-cert-table-extra-data
Open

itecz26 wants to merge 2 commits into
ebourg:masterfrom
itecz26:pe-cert-table-extra-data

Conversation

@itecz26

@itecz26 itecz26 commented Sep 22, 2026

Copy link
Copy Markdown

PE certificate table accepts data smuggled past the signature
the digest excludes the whole certificate table region declared by the data directory, but nothing verifies that the region only holds the signature, so appending bytes and enlarging the certificate table's directory size leaves the digest unchanged and the signature still verifies (CVE-2013-3900 shape). getCertificateTable now rejects a non-EFI table whose declared size runs past the 8-byte-aligned signature entry.

@ebourg

ebourg commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Thank you for the PR. If the goal is to break on signatures rejected by Windows, then maybe this verification should be implemented as a new rule for the SignatureVerifier class. Otherwise it cripples the API and makes it impossible to read the signature from the file.

@itecz26

itecz26 commented Sep 23, 2026

Copy link
Copy Markdown
Author

makes sense, the throw in getCertificateTable was too blunt. moved it into a CertificateTableRule in SignatureVerifier so the signature is still readable and only the verification fails when the certificate table declares more bytes than the signature entry uses. getCertificateTable stays as it was, and PEFile just exposes getCertificateTableTrailingBytes() for the rule to consult. pushed the change with the tests updated to match.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants