鍵を鍛造する:Golden & Silver SAML攻撃のためのC#フレームワーク「SAMLSmith」の内部

SAMLSmithは、カスタムSAMLレスポンスを生成し、Silver SAMLおよびGolden SAML攻撃を実装するためのC# ツールです。SAMLベースの認証システムを扱うセキュリティ研究者やペネトレーションテスター向けに、包括的な機能を提供します。

使用方法

SAMLSmithは、異なる運用シナリオに対応する4つの主要コマンドを提供します:

コマンド 目的 入力方法
generate SAMLレスポンス生成 コマンドラインパラメータ
generateJSON SAMLレスポンス生成 JSON設定ファイル
generateWSJSON WS-Federationレスポンス生成 JSON設定ファイル
generatePFX 証明書の抽出 AD FSの暗号化済み素材

コマンド

generate

コマンドラインパラメータを使用してSAMLレスポンスを生成します:

パラメータ:

  • --pfxPath – PFX証明書ファイルへのパス
  • --pfxPassword – PFXファイルのパスワード(任意)
  • --idpid – IDプロバイダー識別子
  • --recipient – SAMLレスポンスの受信者URL
  • --subjectnameid – SAMLレスポンス内のSubject NameID
  • --audience – SAMLレスポンスのAudience
  • --attributes – key=value,key=value形式のクレーム/属性
  • --inResponseTo – InResponseToパラメータ(任意)

generateJSON

JSON設定ファイルを使用してSAMLレスポンスを生成します:

JSON設定構造:

{
    "pfxPath": "C:\\certs\\signing.pfx",
    "pfxPassword": "password123",
    "idpid": "https://sts.company.com/adfs/services/trust",
    "recipient": "https://app.company.com/sso/saml",
    "subjectnameid": "[email protected]",
    "audience": "https://app.company.com",
    "inResponseTo": "optional_response_id",
    "attributes": {
        "http://schemas.microsoft.com/identity/claims/tenantid": "tenant-guid",
        "http://schemas.microsoft.com/identity/claims/objectidentifier": "user-guid",
        "http://schemas.microsoft.com/identity/claims/displayname": "John Doe",
        "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress": "[email protected]",
        "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "John Doe"
    }
}

generateWSJSON

JSON設定ファイルを使用してWS-Federationレスポンスを生成します。属性の形式がSAMLのJSON形式とは異なる点に注意してください:

JSON設定構造:

{
    "pfxPath": "C:\\certs\\signing.pfx",
    "pfxPassword": "password123",
    "idpid": "https://sts.company.com/adfs/services/trust",
    "recipient": "https://app.company.com/sso/saml",
    "subjectnameid": "[email protected]",
    "audience": "https://app.company.com",
    "inResponseTo": "optional_response_id",
    "attributes": {
        "http://schemas.microsoft.com/identity/claims/tenantid": "tenant-guid",
        "http://schemas.microsoft.com/identity/claims/objectidentifier": "user-guid",
        "http://schemas.microsoft.com/identity/claims/displayname": "John Doe",
        "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress": "[email protected]",
        "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "John Doe"
    }
}

重要: WS-Federationでは、 attributes フィールドはJSONオブジェクト構造ではなく、カンマ区切りの文字列形式を使用します。

generatePFX

AD FSの暗号化済み素材から使用可能な証明書ファイルを抽出します。AD FS構成データベースのEncryptedPFXブロブと、Active DirectoryのDKM復号キーが与えられた場合、トークン署名に使用できるPFX証明書ファイルを生成します:

パラメータ:

  • --encryptedPFXPath – AD FS構成データベースのEncryptedPFXブロブへのパス
  • --dkmKeyPath – Active DirectoryのDKM復号キーへのパス
  • --pfxOutputPath – 復号されたPFX証明書ファイルの出力パス

Silver SAMLの詳細については、こちらを参照してください: クラウドにおけるSilver SAMLとGolden SAMLの紹介

ダウンロード

翻訳元: https://meterpreter.org/forging-the-keys-inside-samlsmith-the-c-framework-for-golden-silver-saml-attacks/

ソース: meterpreter.org