Expand description
ms-icpr — ICertPassage (MS-ICPR) / WCCE client with an ESC1 CSR-SAN injection primitive.
§Purpose
Submit certificate requests to an AD-CS Enterprise CA over RPC and retrieve
the issued certificate. The offensive path this crate enables is ESC1:
against an enrollee-supplies-subject template, a low-privileged user
ships a CSR with a SubjectAltName{otherName, userPrincipalName=...}
extension and the CA emits a client-auth certificate bound to any UPN in
the domain (e.g. administrator@corp.local).
§Status: 0.1.0-dev (pre-alpha)
build_csr_with_upn_sanproduces a valid, signed PKCS#10 CSR carrying the UPN otherName SAN. Offline-testable, round-trip-verified.IcprClient::submit_requestperforms offline pre-flight checks (schema version,min_ra_signatures, CSR shape), NDR-marshals theCertServerRequestopnum-0 input stub, and hands it to the transport. Withrpc::StubTransportyou getError::LiveDcOnlyafter preflight; with the defaultnetworkfeature you getIcprClient::connectwhich speaks SMB2 → sealed\PIPE\cert→CertServerRequest→ decoded response.- Two BIND auth paths:
- NTLMSSP sign+seal (
IcprClient::connect) — end-to-end live. - Kerberos (GSS-KRB5,
RPC_C_AUTHN_GSS_KERBEROS) —IcprClient::connect_kerberosdoes SMB2login_kerberos+IPC$tree connect and produces a client whose BIND PDU carries the caller’sAP-REQ(seekerberos::encode_kerberos_bind_pdu). The per-message RFC 4121 wrap forCertServerRequestsealed calls is not implemented yet —IcprClient::submit_requestreturnsError::LiveDcOnlywith a Kerberos-sealing hint. Consumers wanting relay flows plug in their own transport viaIcprTransport+rpc::encode_cert_server_request/rpc::decode_cert_server_response.
- NTLMSSP sign+seal (
§Example
use ms_icpr::{build_csr_with_upn_san, IcprClient};
let csr = build_csr_with_upn_san("recon", "administrator@corp.local", key_pem)?;
let mut client = IcprClient::stub("corp-CA");
// On a live DC this would issue the cert. Offline: Err(LiveDcOnly).
let _ = client.submit_request(&template, &csr);Re-exports§
pub use csr::build_csr_with_upn_san;pub use csr::build_csr_with_upn_san_and_ekus;pub use csr::parse_rsa_private_key_pem;pub use csr::EkuCarrier;pub use error::Error;pub use error::Result;pub use esc3::build_cmc_pkidata;pub use esc3::build_esc3_request;pub use esc3::sign_pkidata_as_agent;pub use esc3::OID_ENROLLMENT_AGENT_EKU;pub use kerberos::encode_kerberos_auth3_pdu;pub use kerberos::encode_kerberos_bind_pdu;pub use kerberos::KrbTicket;pub use kerberos::ICPR_SYNTAX_UUID;pub use kerberos::RPC_C_AUTHN_GSS_KERBEROS;pub use rpc::decode_cert_server_response;pub use rpc::encode_cert_server_request;pub use rpc::encode_cert_server_request_with_attribs;pub use rpc::encode_cert_server_request_with_san;pub use rpc::CertServerResponse;pub use rpc::IcprClient;pub use rpc::IcprTransport;pub use rpc::IssuedCert;pub use rpc::StubTransport;pub use rpc::CERT_SERVER_REQUEST_OPNUM;pub use rpc::KerberosTransport;pub use rpc::NetworkTransport;
Modules§
- csr
- PKCS#10 CertificationRequest builder with ESC1’s ergonomic knob:
injecting
otherName{userPrincipalName, "administrator@corp.local"}into the requested SubjectAltName extension. - der
- Minimal DER encoder — just enough to build a PKCS#10 CertificationRequest with a SubjectAltName otherName(UPN) extension. Hand-rolled to keep the dep graph flat and the ESC1 primitive fully auditable.
- error
- Error types for ms-icpr.
- esc3
- ESC3 — CMC EnrollOnBehalfOf.
- kerberos
- MS-ICPR Kerberos sealed-bind wire encoder.
- oids
- Well-known OIDs used by MS-ICPR / WCCE certificate requests.
- rpc
- MS-ICPR / MS-WCCE RPC client.