Skip to main content

Crate ms_csra

Crate ms_csra 

Source
Expand description

ms-csra — MS-CSRA (Certificate Services Remote Administration) primitives for CA-side ADCS misconfiguration detection.

§Why this crate

ms-crtd audits templates statically. ms-icpr submits requests. Neither can see the CA’s own configuration flags — and the highest- impact ADCS misconfigurations live there:

  • ESC6 — EDITF_ATTRIBUTESUBJECTALTNAME2 set on the CA. Turns every request-attribute SAN into an issued-cert SAN, regardless of what the template allows.
  • ESC7 — Manage-CA or Manage-Certificates rights delegated to a non-tier-0 principal. Manage-CA can flip ESC6 remotely.
  • ESC11 — RPC interface flags allow unauthenticated / no-integrity binds to the CA’s cert-request interface.

All three flags live in registry-mapped config entries reachable via MS-CSRA ICertAdminD2::GetConfigEntry (opnum 44).

§What this crate ships

  • build_get_config_entry_request — NDR-marshaled input stub for ICertAdminD2::GetConfigEntry(pwszAuthority, pwszNodePath, pwszEntry) at opnum 44 — the registry-mapped reads that carry EditFlags / InterfaceFlags / CRLFlags, which is where ESC6 and ESC11 live.
  • EditFlags / InterfaceFlags / CrlFlags — bitfield decoders + describe() helpers that surface the exact ESC-relevant flags.
  • Esc6Finding / Esc11Finding — audit-shaped decoded findings with severity + remediation.

§What this crate does not do

  • No RPC transport. Callers plug this into dcerpc (opnum-driven \PIPE\cert, binding to ICertAdminD2 at UUID 7fe0d935-dda6-11d1-a71f-00c04fc3141e v0.0 — the interface that carries GetConfigEntry).
  • No LDAP-side template audit (that lives in ms-crtd).

Modules§

config_entry
Well-known registry-mapped config entry paths that GetConfigEntry reads. EditFlags, InterfaceFlags, CRLFlags — all the ESC6 / ESC11 -relevant CA config lives here, not in CR_PROP_*.

Structs§

CrlFlags
CA CRLFlags. Not ESC-critical; ship as decoder for parity with the two above.
EditFlags
CA EditFlags (registry-side value that MS-CSRA exposes via GetCAProperty(EditFlags)). Values from certca.h.
Esc6Finding
Audit finding: an ESC6-exposed CA.
Esc11Finding
Audit finding: an ESC11-exposed CA.
InterfaceFlags
CA InterfaceFlags (IF_*). Missing bits (e.g. absence of IF_ENFORCEENCRYPTICERTREQUEST) can indicate ESC11 exposure.

Enums§

Severity

Constants§

CSRA_D2_INTERFACE_UUID
MS-CSRA ICertAdminD2 interface UUID (7fe0d935-dda6-11d1-a71f-00c04fc3141e, v0.0). Extension interface; carries GetConfigEntry, GetCASecurity, SetConfigEntry, and the other post-Windows-2000 admin methods.
CSRA_INTERFACE_UUID
MS-CSRA ICertAdminD interface UUID (d99e6e73-fc88-11d0-b498-00a0c90312f4, v0.0). Distinct from the MS-WCCE ICertRequestD interface (…312f3) — same UUID prefix, trailing byte differs. This crate does not currently issue calls against ICertAdminD; use CSRA_D2_INTERFACE_UUID for the GetConfigEntry path.
GET_CONFIG_ENTRY_OPNUM
GetConfigEntry opnum on the ICertAdminD2 interface. Reads registry-mapped config entries — the path to EditFlags / InterfaceFlags. Bind against CSRA_D2_INTERFACE_UUID, not CSRA_INTERFACE_UUID.

Functions§

build_get_config_entry_request
Build the NDR-marshaled [in] stub for ICertAdminD2::GetConfigEntry(pwszAuthority, pwszNodePath, pwszEntry). Use this to read EditFlags / InterfaceFlags — see the config_entry module for the well-known paths.
detect_esc6
Given a decoded EditFlags value and the CA it came from, produce an Esc6Finding if the ESC6 bit is set. Returns None if the CA is not exposed.
detect_esc11
Given a decoded InterfaceFlags value and the CA it came from, produce an Esc11Finding if the enforce-encryption bit is missing.