[IT-Security-1] Kerberos

Kerberos


Notes from RWTH Aachen University course 
“IT security 1” Wintersemester 2019/20
professor: Meyer, Ulrike Michaela


  • 什麼是Kerberos

    • 在網路中提供authentication及key agreement的協定們
      • 使網路應用程式可以授權他們的peers
      • 基於shared secret key
    • 基於Needham and Schroeder protocol (in Authentication)
  • 流程:

    1. \(A\) 用帳號密碼登入工作站
    2. \(A\) 向 Key Distribution Center (KDC) 請求 Ticket
    3. \(A\) 用 Ticket 向 File system 取得授權


  • Key Distribution Center (KDC)

    • 包含:
      • Kerberos Authentication Server (AS)
      • Kerberos Ticket Granting Server (TGS)
    • KDC提供ticket和session key
  • Principle Identifiers

    • form: \(\{\text{name}\}:\text{instance@realm}\)
    • \(\text{realm}\) 說明domain
    • \(\text{instance}\) 說明裝置種類(ex. printer)
    • \(\text{name}\) 是在特殊 \(\text{realm}\) 中特殊 \(\text{instance}\) 的實際名稱
  • protocol

    • Long-term keys:
      • \(KDC\) 有一把自己的密鑰 \(k_{KDC}\)
      • \(KDC\) 跟 user \(A\) 有一把 secret master key \(k_A\) (從 \(A\) 的密碼而來)
      • \(KDC\) 跟 resource \(R\) 有一把 secret master key \(k_R\)
      • \(KDC\) 用 \(k_{KDC}\) 加密這些key,並從在database
    • Ticket Granting Tickets:
      • \(A\) 登入後,工作站向 \(KDC\) 請求session key
      • \(KDC:\)
        • 產生session key \(S_A\)
        • 產生 ticket granting ticket (TGT)
          \(\text{TGT}\)\(=k_{KDC}\{\text{"Alice"},\)\(S_A\)\(\text{,timestamp, lifetime}\}\)

        • \(\text{TGT}\) 用來給 \(S_A\),且 \(KDC\) 不儲存任何狀態資訊

        • 傳送 \(k_A\{\text{"KDC"},\) \(S_A\) \(,\) \(TGT\)\(\}\) 給工作站

      • 工作站用 \(A\) 的密碼解密,得到session key \(S_A\)

      用session key而不是master key減少對password的使用
      password的攻擊更困難



    • Tickets :
      • Ticket request: \(A\) 向 \(KDC\) 要求對 \(R\) 的權限
      • 工作站傳送 \(\text{TGT, "R", }S_A(\text{timestamp})\)
      • \(KDC\) 解開 \(\text{TGT}\),得到 \(S_A\)
      • \(KDC\) 產生
        • session key \(k_{AR}\)
        • \(\text{ticket}_R\)\(=k_{R}\{\text{"Alice"},\)\(k_{AR}\)\(\text{,timestamp, lifetime}\}\)
      • \(KDC\) 回傳 \(S_A\{\text{"R"},\) \(k_{AR}\) \(,\) \(\text{ticket}_R\)\(\}\)


    • Login into the Resource R:
      • \(A\) 對 \(R\) 傳送 \((\text{ticket}_R\)\(,k_{AR}(\text{timestamp}))\)
      • \(R\) 回傳\(k_{AR}(\text{timestamp+1})\)


  • Multiple KDC

    • 因為一個主要的KDC會有failure或流量過大的問題
    • Kerberos支援realm 1的使用者請求realm 2的資源
      • Realm 2的KDC像Realm 1的resource


  • Key Version Numbers

    • 若 \(A\) 有了ticket但 \(R\) 更改了master key則會有問題
    • 因此需要定義key version
    • \(R\) 需要有前一個key,並在pre-defined的時間刪除
  • 保障Encryption及Integrity:

    • DES in PCBC (Plaintext-Cipher-Block-Chaining) mode
    • PCBC:
      • encryption:
        • \(c_0:=IV\)
          \(m_0:=0\)
        • \(c_{n+1}:=E_k(m_{n+1}\oplus c_n\oplus m_{n})\)
      • decryption:
        • \(m_{n+1}=D_k(c_{n+1})\oplus c_n\oplus\)\(m_n\)
          \(m_{n+1}=D_k(c_{n+1})\oplus c_n\oplus\)\(D_k(c_{n+n})\oplus c_{n-1}\oplus m_{n-1}\)
          \(m_{n+1}=D_k(c_{n+1})\oplus c_n\oplus D_k(c_{n+n})\oplus c_{n-1\oplus ... \oplus D_k(c_1)\oplus c_0}\)


    • 跟CBC不同的是:CBC的\(c_i\)經過竄改後只會影響\(m_i\)\(m_{i+1}\),PCBC會影響\(m_i,...,m_n\)
    • Problem:
      • 攻擊者仍可對調 \(c_i,c_j\) 使解密還是正確
      • 不提供 integrity
  • Network Layer Addresses in the Tickets

    • \(KDC\) 應檢查 \(\text{TGT}\) 中的 IP address是否跟request時的IP address一樣
    • 使攻擊更難因為需偽造IP address
  • Kerberos v4的限制:

    • 觀念上:
      • 只能用DES in PCBC mode保障encryption和integrity
      • usable only on top of IP(!?)
      • Message byte傳送的順序是sender決定的
      • ticket lifetime太短
      • 不支援委託(ticket無法轉移)
      • principle naming的問題:無法在 \(\text{name}\) 加入 “.”
      • Ticket’s Double encryption
    • 技術上:
      • PCBC mode: non-standard DES mode,沒有integrity保障
      • replay
      • Password attacks:因為密文包含 \(\text{"KDC"}\),所以會被猜測密碼

Kerberos 5

  • 支援不同的加密演算法
    • private-message type:
      • DES-CBC-Hash
      • Hash: CRC, MD4, MD5
    • safe-message type:
      • RSA-MD5-DES
      • DES-MAC
      • DES-MAC-k (not recommanded)
      • RSA-MD4-DES
      • RSA-MD4-DES-k (not recommanded)
    • 還有Specification 2
    • CBC with Cipher Stealing


  • 不只用IP,還有支援其他address type
  • Principal naming限制更少
  • Encoding problems (byte ordering) solved by the use of standard encodings (ANS.1 syntax with the Basic Encoding Rules)
  • TGT跟ticket的改變
    • 不再加密"KDC"到TGT中
    • Kerberos 4Kerberos 5
      TGT-Reply\(k_A\{\text{"KDC"},\) \(S_A\) \(,\) \(\text{TGT}\)\(\}\)\(k_A\{S_A\},\) \(\text{TGT}\)
      Ticket-Reply\(S_A\{\text{"R"},k_{AR},\text{ticket}_R\}\)\(S_A\{\text{"R"},k_{AR}\},\) \(\text{ticket}_R\)

      不會雙重加密 \(\text{TGT},\text{ticket}_R\)

  • New features:
    • 另外的授權機制,在TGT-request中的pre-authenticated data
    • 用sequence number取代timestamp
  • 支援代理機制
    • \(A\) 向 \(ADC\) 請求 \(P\) 的 ticket(有 \(P\) 的address)
    • \(P\) 的行為代表 \(A\)
    • \(A\) 可以控制 \(P\) 的權限
    • 可以有Flag標註是 \(P\) 還是 \(A\)
      • 有Proxiable Ticket Flag和Forwardable Ticket Flag
      • 供應用程式決定要不要接受此ticket
  • ticket lifetime
    • 時間更彈性
    • 可以renew
    • 可以要求之後的ticket
  • 階層性的realm
    • 可以有short-cut,減少request次數
  • Pre-authentication
    • 送出 \(\text{TGT-request}\) 時加上 pre-authentication data
    • 避免字典攻擊、denial of service攻擊(過量的request)
    • 可以用public key crytographic
    • KDC儲存certificate而不是password

Readings
Kaufman Chapter 13 and 14
J. Kohl, B. Neuman: “The Evolution of the Kerberos
Authentication Service”, 1994
RFC 4120: “The Kerberos Network Authentication Service (V5)“, 2005
RFC 4556: “Public Key Cryptography for Initial Authentication in Kerberos (PKINIT)”, 2006

留言

這個網誌中的熱門文章