Skip to content

fix(portable-trust): accept ACS/Microsoft RFC3161 timestamp tokens - #30

Merged
Marc-André Moreau (mamoreau-devolutions) merged 2 commits into
masterfrom
copilot/acs-timestamp-trust-bug
Aug 11, 2026
Merged

fix(portable-trust): accept ACS/Microsoft RFC3161 timestamp tokens#30
Marc-André Moreau (mamoreau-devolutions) merged 2 commits into
masterfrom
copilot/acs-timestamp-trust-bug

Conversation

@mamoreau-devolutions

Copy link
Copy Markdown
Contributor

Summary

Portable trust-verify-pe --require-valid-timestamp rejected real Microsoft ACS / Azure Trusted Signing PE signatures and Microsoft runtime DLLs that Windows accepts as Valid.

Root cause

Two bugs in crates/psign-authenticode-trust/src/rfc3161_extract.rs:

  1. Fractional-second TSTInfo.genTime — ACS emits e.g. 20260810234021.194Z; strict der GeneralizedTime rejected them, so trusted extract returned None.
  2. Attribute certificates in nested timestamp CMS bags — Microsoft Time-Stamp Service tokens embed CertificateChoices [1] entries the cms crate cannot decode, so nested SignedData decode failed (e.g. dbghelp.dll).

Fix

  • Lenient genTime parse (fractional seconds truncated to whole seconds for UtcDate).
  • Rewrite nested timestamp SignedData before decode: keep only X.509 SEQUENCE certs; drop attr-cert choices and CRLs (not needed for imprint / CMS sig / TSA chain).
  • Prefer full attribute DER TLV for untrusted extract.
  • Unit tests for fractional genTime and cert-bag rewrite.
  • Docs: docs/authenticode-trust-stack.md, docs/rust-sip-gaps.md.

Validation

psign-tool portable trust-verify-pe --prefer-timestamp-signing-time --require-valid-timestamp --allow-loose-signing-cert --online-aia <ACS PE>
→ ok

psign-tool portable trust-verify-pe --prefer-timestamp-signing-time --require-valid-timestamp --online-aia C:\WINDOWS\System32\dbghelp.dll
→ ok

cargo test / clippy -p psign-authenticode-trust pass.

Consumer notes (windbg-tool)

A release after merge (e.g. 0.6.2) is needed for Linux CI to pin the published psign-tool zip + SHA256 — unreleased worktree builds cannot be used in release CI.

Recommended ACS PE verify flags after the bump:

psign-tool portable trust-verify-pe \
  --prefer-timestamp-signing-time \
  --require-valid-timestamp \
  --allow-loose-signing-cert \
  --online-aia \
  <signed-pe>

Test plan

  • Unit tests for fractional genTime + SignedData rewrite
  • Local ACS-signed PE with --require-valid-timestamp
  • Local dbghelp.dll with --require-valid-timestamp
  • CI / review

Parse fractional-second TSTInfo genTime (Microsoft ACS) and rewrite nested
timestamp SignedData bags to drop attribute-certificate CertificateChoices
the cms crate cannot decode, so --require-valid-timestamp works with AuthRoot.
Prepare release packaging after the portable ACS/Microsoft RFC3161
timestamp trust fix.
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) merged commit c78b20c into master Aug 11, 2026
36 checks passed
@mamoreau-devolutions
Marc-André Moreau (mamoreau-devolutions) deleted the copilot/acs-timestamp-trust-bug branch August 11, 2026 18:31
Marc-André Moreau (mamoreau-devolutions) added a commit to Devolutions/windbg-tool that referenced this pull request Aug 11, 2026
## Summary
- Windows packages dry-run failed validating ACS-signed PEs: `timestamp
required by policy but no cryptographically valid trusted RFC3161
timestamp token was found`.
- Signatures were good (Windows Authenticode Valid). The bug was in
**psign 0.6.1** portable RFC3161 trust.

## Fix
- Bump CI `psign-tool` pin to **0.6.2** (`psign-tool-linux-x64.zip`
SHA256 updated).
- Restore full portable trust policy for project-owned PEs:
  ```
  psign-tool portable trust-verify-pe \
    --prefer-timestamp-signing-time \
    --require-valid-timestamp \
    --allow-loose-signing-cert \
    --online-aia
  ```
- Keep `verify-pe` + signer CN checks for project-owned and Microsoft
runtime PEs.
- Keep an explicit embedded RFC3161 attribute presence check on
project-owned PEs for clearer failures.

## Upstream
- psign fix: Devolutions/psign#30
- psign release:
https://github.com/Devolutions/psign/releases/tag/v0.6.2

## Failed run

https://github.com/Devolutions/windbg-tool/actions/runs/31491249545/job/93780036559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant