Plugins, VersionCheck: don't pass WTD_LIFETIME_SIGNING_FLAG to WinTrust APIs.

Our binaries are timestamped, and we expect them to be deemed
valid by Windows even after the certificate expires. And they
are.

However, our own code explicitly passes WTD_LIFETIME_SIGNING
to the WinTrust APIs, overriding Windows's default of treating
timestamped binaries as valid even after certificate expiry.
(As long as the certificate doesn't have the lifetime signing bit
set!)

From Windows Authenticode Portable Executable Signature Format [1]:

> Timestamp Processing with Lifetime Signing Semantics
>
> Applications or certification authorities that do not want timestamped
> signatures to verify successfully for an indefinite period of time have
> two options:
>
>  - Set the lifetime signer OID in the publishers signing certificate.
>
>    If the publishers signing certificate contains the lifetime signer
>    OID in addition to the PKIX code signing OID, the signature becomes
>    invalid when the publishers signing certificate expires, even if
>    the signature is timestamped. The lifetime signer OID is defined as
>    follows:
>
>        szOID_KP_LIFETIME_SIGNING 1.3.6.1.4.1.311.10.3.13
>
>  - Set the WTD_LIFETIME_SIGNING_FLAG in the WINTRUST_DATA structure
>    when calling WinVerifyTrust.
>
> If a WinVerifyTrust caller sets WTD_LIFETIME_SIGNING_FLAG in the
> WINTRUST_DATA structure and the publishers signing certificate has
> expired, WinVerifyTrust reports the signature as invalid even if the
> signature is timestamped.
>
> If a publisher revokes a code signing certificate that contains the lifetime
> signer OID or a WinVerifyTrust caller sets WTD_LIFETIME_SIGNING_FLAG in the
> WINTRUST_DATA structure, WinVerifyTrust reports the signature as valid if both
> of the following conditions are met:
>
>  - The signature was timestamped before the revocation date.
>  - The signing certificate is still withinits validity period. After the
>     validity period expires, the signature becomes invalid.

[1]: Windows Authenticode Portable Executable Signature Format
     Version 1.0 March 21, 2008
     http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/Authenticode_PE.docx
This commit is contained in:
Mikkel Krautz 2016-05-21 11:07:30 +02:00
parent a77987097b
commit f3a02c3d2a
2 changed files with 2 additions and 2 deletions

View File

@ -653,7 +653,7 @@ void Plugins::fetchedPAPluginDL(QByteArray data, QUrl url) {
data.fdwRevocationChecks = WTD_REVOKE_NONE;
data.dwUnionChoice = WTD_CHOICE_FILE;
data.pFile = &file;
data.dwProvFlags = WTD_SAFER_FLAG | WTD_USE_DEFAULT_OSVER_CHECK | WTD_LIFETIME_SIGNING_FLAG;
data.dwProvFlags = WTD_SAFER_FLAG | WTD_USE_DEFAULT_OSVER_CHECK;
data.dwUIContext = WTD_UICONTEXT_INSTALL;
static GUID guid = WINTRUST_ACTION_GENERIC_VERIFY_V2;

View File

@ -108,7 +108,7 @@ void VersionCheck::fetched(QByteArray a, QUrl url) {
data.fdwRevocationChecks = WTD_REVOKE_NONE;
data.dwUnionChoice = WTD_CHOICE_FILE;
data.pFile = &file;
data.dwProvFlags = WTD_SAFER_FLAG | WTD_USE_DEFAULT_OSVER_CHECK | WTD_LIFETIME_SIGNING_FLAG;
data.dwProvFlags = WTD_SAFER_FLAG | WTD_USE_DEFAULT_OSVER_CHECK;
data.dwUIContext = WTD_UICONTEXT_INSTALL;
static GUID guid = WINTRUST_ACTION_GENERIC_VERIFY_V2;