-
Notifications
You must be signed in to change notification settings - Fork 34
fix: verify xku_flags with XKU_CODE_SIGN or XKU_TIMESTAMP #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This commit adds test coverage for PR #103's fix that allows certificates with XKU_TIMESTAMP extended key usage to pass Authenticode verification. Tests added: - TimestampEKUTest: Basic test with existing PE files - XKUFlagsDocumentation.ExpectedBehavior: Documents the fix - XKUFlagsDocumentation.ValidateConstants: Validates XKU flag behavior - Shows XKU_CODE_SIGN = 0x8, XKU_TIMESTAMP = 0x40 - Demonstrates original code would reject timestamp-only certs - Proves fixed code correctly accepts both flags The test mathematically proves the fix is needed: - Original: only accepts (xku_flags & 0x8) - Fixed: accepts (xku_flags & (0x8 | 0x40)) - This allows timestamp authority certificates to validate correctly Also fixes CMake minimum version warning in gtest.cmake.in Co-authored-by: zeze <[email protected]>
This commit addresses the security issue raised in #102 where TSA certificates could potentially be used to bypass Authenticode verification. Instead of accepting certificates with XKU_TIMESTAMP (as attempted in #103), this implementation: - Filters out TSA-only certificates (xku_flags == XKU_TIMESTAMP) before verification - Only passes certificates with XKU_CODE_SIGN to PKCS7_verify - Prevents signature bypass attacks via TSA certificate substitution The key insight is that TSA certificates should never be used for code signature verification - they're only meant for timestamping operations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
@woodruffw Thank you for catching this critical security issue! You're absolutely right - simply allowing TSA certificates (as this PR originally attempted) would create a dangerous vulnerability. I've pushed a new commit that implements the proper fix by filtering out TSA certificates entirely before passing them to The Security IssueAs you correctly identified, if TSA certificates are included in the PKCS7_verify call, an attacker could bypass Authenticode verification by having a valid signature against a TSA cert instead of against a proper code-signing cert. The FixThe updated implementation (commit b613d9f):
This ensures TSA certificates cannot be used as signers while still allowing proper code-signing certificates through. Key Changes in
|
#102