Repository navigation
Commit 03ee8d0
feat(pku2u): close Windows parity gaps (#733)
## Prerequisite fixes
Merged into `master` and consumed by this branch:
- [#736](#736) — propagate
Kerberos `EXTENDED_ERROR` and `IDENTIFY` GSS request flags
- [#737](#737) — generate
Kerberos MICs with the negotiated AES-128/AES-256 size
## Summary
Closes the PKU2U gaps identified by comparing `sspi-rs` with Windows 11
`pku2u.dll` 10.0.26100.8737 and the MS-PKU2U/MS-NEGOEX specifications.
- completes the PKU2U initiator and acceptor state machines, including
PKINIT AS, Ticket/AP, Finished, VERIFY, and channel-binding flows
- adds negotiated MIC, signature, sealed Wrap, and integrity-only Wrap
support with strict direction, sequence, header, EC/RRC, and buffer
validation
- aligns package metadata, SPNEGO/NEGOEX routing and mechanism
selection, checksum selection, GSS flags, nonce handling, and KRB-ERROR
propagation
- hardens CMS signer/content binding, exact peer-certificate trust,
certificate time/usage policy, DH parameter validation, and bounded
process-wide authenticator replay protection
- replaces the captured machine identifier with a cryptographically
random process-lifetime identifier matching MS-KILE per-boot semantics
- supports multiple credentials and Windows CNG-backed non-exportable
private keys
- exposes portable peer-name, peer-certificate, and certificate-trust
context queries
- adds end-to-end coverage and production-path malformed-token fuzzing
## PKU2U parity roadmap
- [x] package metadata and context-size parity
- [x] negotiated checksum and GSS flag handling
- [x] MIC, signature, channel binding, and per-direction sequence state
- [x] sealed and integrity-only multi-buffer Wrap/Unwrap
- [x] correct SPNEGO/NEGOEX layering, mechanism selection, and routing
- [x] CMS content, signer, nonce, and KRB-ERROR validation
- [x] trust metadata, credential selection, and non-exportable CNG keys
- [x] complete secured PKU2U acceptor
- [x] exact client/server certificate trust and certificate-bound
principals
- [x] allowlisted DH parameters and full-window cross-context replay
protection
- [x] portable peer-name, certificate, and trust context queries
- [x] end-to-end, tamper, replay, and malformed framing tests
- [x] dedicated PKU2U fuzz target using the production NEGOEX parsers
- [x] final IDA-parity and security audit
## Static-analysis follow-up
- [x] trace peer-certificate policy: both directions call
`IntPstValidate` with the current system time and role
- [x] enforce certificate validity, digital-signature KeyUsage, and
PKINIT/client-auth EKU before trust decisions
- [x] trace machine identity to LSA supplemental token information and
replace the captured constant with per-process/per-boot random state
- [x] map Windows ticket-cache keys, contents, expiry, invalidation, and
cache-hit AS bypass
- [x] verify this Windows build accepts only DH `PA-PK-AS-REP`;
`encKeyPack` is intentionally not implemented
- [x] map package context attributes plus native token/export/import
surfaces
- [ ] implement cross-context ticket reuse — blocked on real-wire
confirmation of cache-hit Finished/VERIFY transcript semantics and
acceptor long-term ticket-key lifecycle
## Validation
- `cargo test -p sspi --all-features`
- `cargo clippy -p sspi --all-targets --all-features -- -D warnings -A
clippy::non_ascii_literal`
- `cargo +nightly fuzz build pku2u_tokens`
The current host has no `MS-Organization-P2P-Access` certificate with a
private key, so real Windows wire capture and safe implementation of
ticket-cache handshake bypass remain outside the statically verified
scope.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7a3de33 commit 03ee8d0
18 files changed
Lines changed: 3231 additions & 460 deletions
File tree
- fuzz
- fuzz_targets
- src
- kerberos
- negotiate
- pku2u
- cert_utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
88 | 98 | | |
89 | 99 | | |
90 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
280 | 284 | | |
281 | 285 | | |
282 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
0 commit comments