ms-pkca
PKINIT (RFC 4556) client for Active Directory Certificate Services abuse, in Rust — PA-PK-AS-REQ / PA-PK-AS-REP with an X.509 client cert, Diffie-Hellman shared-secret KDF, and the UnPAC-the-hash primitive that lifts an NT hash out of PAC_CREDENTIAL_DATA returned in the AS-REP.
Status
0.1.0-dev — pre-alpha, not wire-compatible against a live KDC yet (AS-REP parse + paChecksum are the remaining pieces). Part of the icedracon Rust offensive AD ecosystem.
What it does
Once you have a client certificate — typically minted through an ESC1/ESC6/ESC9/ESC13/ESC14/ESC15 abuse chain via ms-icpr — ms-pkca turns that certificate into a Kerberos TGT. It builds a full PA-PK-AS-REQ from a PEM cert + RSA key (RFC 4556 §3.2.1 AuthPack + PKAuthenticator, wrapped in RFC 5652 SignedData + ContentInfo), performs MODP-1024 or MODP-2048 Diffie-Hellman, and runs the RFC 4556 §3.2.3.1 octet-string-to-key KDF to derive the AS-REP encryption key. When a PAC_CREDENTIAL_INFO is present, unpac_the_hash extracts the NT hash — the pass-the-hash-from-a-cert primitive.
Usage
use ;
let client = new;
let cert = read?;
let key = read?;
let rep = client.request_tgt_with_cert?;
// 0.1.0-dev: take the built wire bytes yourself; the KDC round-trip
// lands in 0.2 once picky-krb's AS-REP path is fully plumbed.
let as_req_der: = rep.debug_as_req_der;
// Once you have a decrypted PAC_CREDENTIAL_DATA blob from a AS-REP:
let nt_hash: = unpac_the_hash?;
# Ok::
What works / what does not (this version)
- Working:
- RFC 4556 §3.2.1
AuthPack+PKAuthenticatorASN.1 encoders - RFC 5652
SignedData+ContentInfo(minimal, hand-rolled onder) PA-PK-AS-REQfull DER assembly from a PEM cert + RSA key- MODP-1024 (Oakley group 2) and MODP-2048 (group 14) Diffie-Hellman
- RFC 4556 §3.2.3.1
octet-string-to-keyKDF (SHA-1 / SHA-256) PAC_CREDENTIAL_INFOheader parse + NT-hash extraction from decryptedPAC_CREDENTIAL_DATA(heuristic NDR scan)
- RFC 4556 §3.2.1
- Stubbed / deferred:
- No network I/O today —
PkinitClient::request_tgt_with_certreturns the built DER inAsRepResult::debug_as_req_der - AS-REP parsing not wired, so
ticket/session_key/pac_credential_infocome back empty paChecksum(Kerberos-layer concern) supplied by caller viaBuildOptions- No PKCS#12 (
.pfx) loader — pre-convert (openssl pkcs12 -in x.pfx -out x.pem -nodes) - No RSA key-transport (
PkinitKeyDataKeyPack) branch — modern KDCs are DH-only
- No network I/O today —
Related icedracon crates
Part of a 4-crate ADCS attack chain — template parsing all the way to a live PKINIT-derived TGT:
ms-crtd— parsepKICertificateTemplateLDAP attrs, emit ESC findingsms-icpr— submit ESC1 CSRs to the CA over MS-ICPR / MS-WCCE- ms-pkca (this crate) — PKINIT the issued cert into a Kerberos TGT + UnPAC-the-hash
ms-kile-fast— RFC 6113 FAST armor for the AS-REQ / TGS-REQ
Together they aim for Certipy parity in pure Rust with an S-tier dep tree.
Dependencies
S-tier minimal: der, spki, x509-cert, const-oid, rsa, sha1, sha2, aes, cbc, num-bigint-dig, thiserror, rand_core. No serde_json, no rasn. CMS is stable enough that hand-rolling SignedData against der is cheaper than pulling in rasn-cms and its runtime.
The network feature (on by default) pulls picky-krb + picky-asn1(-der) for Kerberos AS-REQ/AS-REP encoders. Disable it for a pure-offline PA-PK-AS-REQ builder.
License
MIT (C) 2026 zevs