Expand description
§kerbcore
Pure-Rust Kerberos building blocks — no FFI, no dependency on a host krb5,
#![forbid(unsafe_code)]. Three layers, each cross-checked against RFC
known-answer vectors and (for the codec) a differential re-encode oracle:
crypto— RFC 3961 / 3962 AES-CTS-HMAC-SHA1 (etypes 17 & 18): n-fold, AES CBC-CTS, DR/DK, HMAC-SHA1-96, subkey derivation, PBKDF2 string-to-key, and the generic encrypt-then-integrity primitive.rfc8009— RFC 8009 AES-SHA2 (etypes 19 & 20): SP800-108 KDF, encrypt-then-MAC, string-to-key.rc4— RFC 4757 RC4-HMAC (etype 23).der+types+messages— a hand-rolled X.690 DER codec (total, never-panicking decoder) and the RFC 4120 message set (Ticket, AS/TGS REQ+REP, KRB-ERROR, PA-DATA).clientassembles AS-REQ / TGS-REQ and parses the KDC’s reply — including the AP exchange (AP-REQ builder + AP-REP mutual-auth verification), EncKDCRepPart nonce anti-replay, ETYPE-INFO2s2kparams, and RFC 6806 cross-realm referral detection + credential lifecycle (renew/validate).- Higher protocol layers:
gss(RFC 4121 krb5-gss context token + MIC + Wrap),spnego(RFC 4178 negotiation),kkdcp(MS-KKDCP HTTPS proxy container),kpasswd(RFC 3244 change/set-password + a KRB-PRIV codec), andfast(RFC 6113 FAST wire codec + KRB-FX-CF2 armor-key math — the end-to-end AES-SHA1 PRF + a live-DC round-trip are the remaining gap; see the module docs).
This is the crate that replaces picky-krb inside ADhammer’s Kerberos stack.
Offensive compositions (golden / silver / diamond / S4U-abuse / PKINIT-relay)
intentionally do not live here — they stay in the ADhammer CLI per its
dual-use rule.
§Status
0.2.x — the AS/TGS crypto + codec + client are complete and live-validated
(real TGT + service ticket) against Windows Server 2019 / 2022 / 2025. The API
is pre-1.0 and may change. 0.2.0 adds the typed KerberosKey / Enctype
abstraction: one key value dispatches encrypt / decrypt / checksum / string-to-key
across the whole etype matrix (17/18/19/20/23), zeroizes its bytes on drop, and never
prints them via Debug. (The client::build_tgs_req wire path still targets the
AES-SHA1 session-key profile AD issues; migrating it onto KerberosKey is next.)
Re-exports§
pub use keys::Enctype;pub use keys::KerberosKey;pub use keys::KeyError;pub use crypto::*;
Modules§
- acceptor
- Server-side AP-REQ acceptor scaffold — the half kerbcore was missing.
- client
- AS-exchange client helpers — assemble an AS-REQ, build the PA-ENC-TIMESTAMP
pre-auth, and parse the pieces of the KDC’s reply. Pure (no I/O): the caller
owns the socket. This is the glue that ties
crate::crypto/crate::rfc8009(keys) tocrate::messages(wire) into a real Kerberos AS handshake — the last layer beforekerbcorecan replacepicky-krb. - config
- MIT
krb5.confloader — the migration path for callers coming from libgssapi. - crypto
- RFC 3961 / RFC 3962 crypto for the AES-CTS-HMAC-SHA1 Kerberos profiles —
aes128-cts-hmac-sha1-96(etype 17) andaes256-cts-hmac-sha1-96(etype 18), the AES profiles every modern Active Directory KDC negotiates. - der
- Minimal DER (X.690) codec — only the subset RFC 4120 Kerberos needs.
- fast
- RFC 6113 — Kerberos FAST (Flexible Authentication Secure Tunneling), the
ms-kile-fastarmoring layer. FAST wraps an AS/TGS exchange inside an armored tunnel keyed by an armor key, defeating offline pre-auth dictionary attacks and enabling PKINIT/OTP secure channels. - gss
- RFC 4121 — the Kerberos V5 GSS-API mechanism (krb5-gss).
- keys
- Typed enctype + key abstraction (0.2.0). One
KerberosKeycarries itsEnctypeand dispatches encrypt / decrypt / checksum / string-to-key to the correct family, so a caller can no longer (a) advertise the wrong etype, (b) feed a mis-sized key into an AES primitive (previously apanic!), or (c) leak key bytes throughDebug. This wraps the proven per-family code incrate::crypto/crate::rfc8009/crate::rc4— it is a dispatch layer, not a reimplementation. - kkdcp
- MS-KKDCP — the Kerberos KDC Proxy Protocol. Tunnels AS/TGS exchanges to a KDC over HTTPS
(POST to
https://<proxy>/KdcProxy) when UDP/TCP 88 is not reachable — the common path for Kerberos from outside a network boundary. - kpasswd
- RFC 3244 / MS-KPWD — the Kerberos change-password / set-password protocol (port 464).
- messages
- RFC 4120 message layer —
Ticket,KDC-REQ(AS-REQ / TGS-REQ),KDC-REP(AS-REP / TGS-REP), andKRB-ERROR. Built oncrate::derandcrate::types; everydecode()is total (no panics on hostile bytes). - rc4
- etype 23 —
rc4-hmac(RFC 4757 / MS-KILE). - rfc8009
- etypes 19 & 20 — the RFC 8009 AES-SHA2 Kerberos profiles:
aes128-cts-hmac-sha256-128(19) andaes256-cts-hmac-sha384-192(20). - spnego
- RFC 4178 — SPNEGO (the
1.3.6.1.5.5.2GSS pseudo-mechanism used by SMB/HTTP/LDAP on Windows). SPNEGO negotiates which real mechanism (here:crate::gsskrb5) both sides speak, then carries that mechanism’s tokens inside its own frames. - types
- RFC 4120 foundational data types — the shared vocabulary every Kerberos
message is built from. Each type owns its DER
encode()and a totaldecode()(no panics on hostile bytes; seecrate::der).
Enums§
- Kerb
Error - Umbrella error covering every failure mode kerbcore surfaces. Per-module
errors (
DerError,KeyError,GssError, …) are the precise types the individual APIs return;KerbErroris what a caller uses at their public API boundary when they want ONE error type to bubble.