ms-pkca
STATUS: pre-alpha (0.1.0-dev). NOT wire-compatible yet.
PKINIT (RFC 4556) client for Active Directory Certificate Services abuse —
PA-PK-AS-REQ / PA-PK-AS-REP with X.509 client cert, DH shared-secret KDF,
and the UnPAC-the-hash primitive (extract NT hash from
PAC_CREDENTIAL_DATA returned in the AS-REP).
Backend for ESC1 / ESC6 / ESC9 / ESC13 / ESC14 / ESC15 exploitation once the certificate has been minted (this crate does not attack AD CS itself; it turns a certificate into a TGT and, where possible, credentials).
What works in 0.1.0-dev
- 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 decrypted
PAC_CREDENTIAL_DATA(heuristic NDR scan)
What is stubbed / deferred
- No network I/O.
PkinitClient::request_tgt_with_certbuilds the request DER and returns it inAsRepResult::debug_as_req_der; it does not send anything to a KDC. - No AS-REP parsing yet, so
AsRepResult.ticket/session_key/pac_credential_infoare always empty. The 0.2 pass will wire a Kerberos stack in. - No
paChecksumcomputation. The AS-REQ-body checksum is a Kerberos-layer concern; caller supplies it viaBuildOptions. - No PKCS#12 (
.pfx) loader.request_tgt_with_pfxreturnsError::PfxUnsupported— convert to PEM (openssl pkcs12 -in x.pfx -out x.pem -nodes) and use the cert path. - No RSA key-transport (
PkinitKeyDataKeyPack) branch — modern KDCs accept DH only.
Minimal usage
use ;
let client = new;
let cert = read?;
let key = read?;
let rep = client.request_tgt_with_cert?;
// In 0.1.0-dev, take the wire bytes yourself:
let as_req_der: = rep.debug_as_req_der;
// UnPAC-the-hash on a decrypted PAC_CREDENTIAL_DATA blob:
let nt_hash = unpac_the_hash?; // [u8; 16]
Dependencies
S-tier minimal: der, spki, x509-cert, const-oid, rsa, sha1,
sha2, num-bigint-dig, thiserror, rand_core. No serde_json, no
rasn, no picky-krb (deliberately — CMS is stable and hand-rolling it
against der is cheaper than importing a whole runtime).
License
MIT.