Lion Cipher Lab

Build Kerberos cross-realm authentication from scratch

Why it matters

Somebody in your organisation is going to say the sentence 'we just added a forest trust with the acquisition' and everyone in the room is going to nod, because it sounds like plumbing. It is not plumbing. An inter-realm trust is a decision to let another organisation's key distribution centre vouch for identities, and for group memberships, that your own services will then believe. It is one of the largest privilege-boundary changes a company can make with a single command, and it is routinely made by people who have never seen what actually crosses the wire. This lab makes you see it. You…

What you'll learn

Steps in this lab

  1. Zero assumptions: realm, principal, TGT, KDC, and what 'cross-realm' means
  2. What this lab is NOT, so you can place it against the ones you may have done
  3. Set up: a folder and a Python you already have
  4. Create krbcrypto.py -- the Kerberos crypto profile, written from the specification
  5. Prove the crypto before you build on it: 51/51 published vectors
  6. Create krbrealm.py -- real DER, the transited field, and the KDCs
  7. The transited field, and why it is the strangest thing in Kerberos
  8. Create crossrealm.py -- the harness -- and run the whole thing
  9. Section [2]: the transited encoder, checked against the RFC's own examples
  10. Section [3]: the happy path, hop by hop -- this is the lab
  11. Failure 1: the two KDCs stop agreeing on the trust key
  12. Failure 2: one-way trust, and why 'we have a trust' is not an answer
  13. Failure 3: referrals and name canonicalization (RFC 6806)
  14. Failure 4: clock skew, at exactly the boundary
  15. Failure 5: replay, and what a replay cache is actually for
  16. Failure 6: the right ticket at the wrong service, and why realm is part of the name
  17. Section [10]: the multi-hop path, and a KDC that quietly lies
  18. Section [11]: authorization data your KDC never issued, and SID filtering
  19. Judgment: cross-realm Kerberos, or SAML/OIDC federation, or one shared identity provider?
  20. When NOT to build a trust, and how a pro handles the one they cannot avoid
  21. What is real here, what is a teaching encoding, and where to go next
  22. Clean up

Open the full interactive lab →