Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
red-shadow — AWS IAM設定をスキャンして、グループに対するユーザーアクションを制限できない誤設定された拒否ポリシーを検出することでシャドウ管理者を特定し、権限昇格の検出と修復を可能にします。 | Kitploit
ツール/GitHubGitHub/lightspin-tech/red-shadow
クラウドインフラストラクチャセキュリティ脆弱性スキャナーペネトレーションテストクラウドセキュリティアイデンティティ&アクセス管理 (IAM)設定ミス
GitHublightspin-tech/red-shadow

red-shadow

AWS IAM設定をスキャンして、グループに対するユーザーアクションを制限できない誤設定された拒否ポリシーを検出することでシャドウ管理者を特定し、権限昇格の検出と修復を可能にします。

リポジトリを見る
95225年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

red-shadow

Red-Shadow

Lightspin AWS IAM 脆弱性スキャナー

説明

Lightspinのセキュリティリサーチチームが発見した、グループのユーザーに影響を与えない誤って設定された拒否ポリシーに基づいて、AWS IAMのシャドウ管理者をスキャンします。

このツールは、以下のIAMオブジェクトにおける設定ミスを検出します。

  • Managed Policies

  • Users Inline Policies

  • Groups Inline Policies

  • Roles Inline Policies

研究概要

グループに適用される拒否ポリシーのAWS IAM評価ロジックは、多くのセキュリティエンジニアが他の認証メカニズムで慣れている方法とは異なります。

グループリソースを持つポリシーに明示的な拒否があると仮定します。その場合、これはグループアクションにのみ影響し、ユーザーアクションには影響しません。そのため、たとえばActive Directoryと同じプロセスであると想定すると、組織は設定ミスや脆弱性にさらされることになります。

脆弱なJSONポリシーの例:

root@kitploit:~
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "ProtectManagersByDeny",
            "Effect": "Deny",
            "Action": "*",
            "Resource": "arn:aws:iam::123456789999:group/managers"
        }
    ]
}

この例では、ポリシーは、そのポリシーがアタッチされたユーザー、グループ、またはロールが managers というグループに対して行うすべてのIAMアクションを拒否する必要があります。

実際には、 iam:ChangePassword のような単純なIAMアクションは、拒否ポリシーが無効であるため機能します。

完全なセキュリティリサーチブログへのリンク

検出

AWS IAMでは、ユーザーオブジェクトのアクションとグループオブジェクトのアクションが明確に分離されています。

以下のリストは、ツールがグループに影響を与える拒否ポリシーに対してスキャンするユーザーオブジェクトアクション(ワイルドカードを除く)です。

root@kitploit:~
AWS_USER_ACTIONS = ["iam:CreateUser",
                     "iam:GetUser",
                     "iam:UpdateUser",
                     "iam:DeleteUser",
                     "iam:GetUserPolicy",
                     "iam:PutUserPolicy",
                     "iam:DeleteUserPolicy",
                     "iam:ListUserPolicies",
                     "iam:AttachUserPolicy",
                     "iam:DetachUserPolicy",
                     "iam:ListAttachedUserPolicies",
                     "iam:SimulatePrincipalPolicy",
                     "iam:GetContextKeysForPrincipalPolicy",
                     "iam:TagUser",
                     "iam:UpdateSSHPublicKey",
                     "iam:UntagUser",
                     "iam:GetSSHPublicKey",
                     "iam:ListUserTags",
                     "iam:DeleteSSHPublicKey",
                     "iam:GetLoginProfile",
                     "iam:GetAccessKeyLastUsed",
                     "iam:UpdateLoginProfile",
                     "iam:UploadSigningCertificate",
                     "iam:DeleteLoginProfile",
                     "iam:ListSigningCertificates",
                     "iam:CreateLoginProfile",
                     "iam:UpdateSigningCertificate",
                     "iam:EnableMFADevice",
                     "iam:DeleteSigningCertificate",
                     "iam:ResyncMFADevice",
                     "iam:ListServiceSpecificCredentials",
                     "iam:ListMFADevices",
                     "iam:ResetServiceSpecificCredential",
                     "iam:DeactivateMFADevice",
                     "iam:CreateServiceSpecificCredential",
                     "iam:ChangePassword",
                     "iam:UpdateServiceSpecificCredential",
                     "iam:CreateAccessKey",
                     "iam:DeleteServiceSpecificCredential",
                     "iam:ListAccessKeys",
                     "iam:PutUserPermissionsBoundary",
                     "iam:UpdateAccessKey",
                     "iam:DeleteUserPermissionsBoundary",
                     "iam:DeleteAccessKey",
                     "iam:ListGroupsForUser",
                     "iam:ListSSHPublicKeys",
                     "iam:UploadSSHPublicKey"]

上記のユーザーオブジェクトアクションの多くは、管理者のパスワードリセット、ルートアカウントのMFA無効化など、権限昇格やアカウント侵害に容易につながる可能性があります。

要件

Red-ShadowはPython 3とBoto3で構築されています。

このツールには以下が必要です。

  • OS環境変数にアクセスキーを持つIAMユーザー
  • IAMユーザーがスキャナーを実行するための十分な権限
  • Python 3およびpip3のインストール

インストール

root@kitploit:~
sudo git clone https://github.com/lightspin-tech/red-shadow.git
cd red-shadow
pip3 install -r requirements.txt

使用方法

root@kitploit:~
python3 red-shadow.py

結果の分析

結果は、AWSにおいてこのような権限回避の脆弱性があるIAMオブジェクトを明らかにします。

出力例:

root@kitploit:~
++ Starting Red-Shadow ++

++ AWS IAM Vulnerability Scanner
++ Red Shadow scans for shadow admins in AWS IAM based on misconfigured deny policies not affecting users in groups

Step 1: Searching for IAM Group misconfigurations in managed policies
Found potential misconfiguration at arn:aws:iam::123456789999:policy/ProtectManagers
Progress: |██████████████████████████████████████████████████| 100.0% Complete
Step 2: Searching for IAM Group misconfigurations in Users inline policies
Progress: |██████████████████████████████████████████████████| 100.0% Complete
Step 3: Searching for IAM Group misconfigurations in Groups inline policies
Progress: |██████████████████████████████████████████████████| 100.0% Complete
Step 4: Searching for IAM Group misconfigurations in Roles inline policies
Progress: |██████████████████████████████████████████████████| 100.0% Complete
Done

このコンソール出力から、ProtectManagers拒否ポリシーが無効であり、上記の権限昇格などの攻撃に対して脆弱であることがわかります。

シミュレーションと悪用

IAM脆弱性を検証し、悪用を実行するには、次のフローを実行できます。

  1. aws iam create-group --group-name managers
  2. aws iam attach-group-policy --group-name managers --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
  3. aws iam create-user --user-name JohnAdmin
  4. aws iam add-user-to-group --user-name JohnAdmin --group-name managers
  5. 以下の内容でpolicy.jsonファイルを作成します(アカウントIDを置き換えてください)。
root@kitploit:~
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ProtectManagersByDeny",
      "Effect": "Deny",
      "Action": "*",
      "Resource": "arn:aws:iam::123456789999:group/managers"
    }
  ]
}
  1. aws iam create-policy --policy-name ProtectManagers --policy-document file://policy.json
  2. aws iam create-group --group-name backend-dev
  3. aws iam create-user --user-name BobAttacker
  4. aws iam add-user-to-group --user-name BobAttacker --group-name backend-dev
  5. aws iam attach-group-policy --group-name backend-dev --policy-arn arn:aws:iam::123456789999:policy/ProtectManagers
  6. backend-devグループのユーザーがアクセスキーを作成できるようにするポリシーをpolicy_iam.jsonファイルに作成します。
root@kitploit:~
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "iam:CreateAccessKey",
            "Resource": "*"
        }
    ]
}
  1. aws iam create-policy --policy-name devCreateAccessKeys --policy-document file://policy_iam.json
  2. aws iam attach-group-policy --group-name backend-dev --policy-arn arn:aws:iam::123456789999:policy/devCreateAccessKeys
  3. 次のコマンドで構成を確認します。 aws iam list-attached-group-policies --group backend-dev
  4. aws iam create-access-key --user-name BobAttacker
  5. 新しいアクセスキーとシークレットをAWSプロファイル(ローカル環境)に設定します。
  6. これで、ユーザーBobAttackerはすべてのリソースのアクセスキーを作成できますが、managersグループに対する明示的な拒否が設定されています。

次のコマンドを使用して脆弱性を悪用しましょう。

aws iam create-access-key --user-name JohnAdmin --profile BobAttacker

権限昇格完了!

修復

権限回避の脆弱性があるポリシーを見つけた場合、脆弱性を修復してポリシーを修正するには2つの方法があります。

オプション1: 無効なIAMアクションを回避するために、グループの代わりにリソースフィールドに関連するすべてのユーザーを定義し、すべてのグループアクションを拒否します。例:

root@kitploit:~
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "DenySpecificUserActions",
            "Effect": "Deny",
            "Action": [
                "iam:CreateLoginProfile",
                "iam:ChangePassword",
                "iam:CreateAccessKey"
            ],
            "Resource": [
                "arn:aws:iam::123456789999:user/[email protected]",
                "arn:aws:iam::123456789999:user/[email protected]",
                "arn:aws:iam::123456789999:user/[email protected]"
            ]
        },
        {
            "Sid": "DenyAllGroupActions",
            "Effect": "Deny",
            "Action": "*",
            "Resource": "arn:aws:iam::123456789999:group/managers"
        }
    ]
}

オプション2: ポリシーで iam:ResourceTag を使用した条件を使用します。例:

root@kitploit:~
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Deny",
            "Action": [
                "iam:CreateLoginProfile",
                "iam:ChangePassword",
                "iam:CreateAccessKey"
            ],
            "Resource": "*",
            "Condition": {
                "ForAnyValue:StringEquals": {
                    "iam:ResourceTag/group": "managers"
                }
            }
        }
    ]
}

お問い合わせ

この研究はLightspinのセキュリティリサーチチームによって実施されました。 詳細については、[email protected]までお問い合わせください。

ライセンス

このリポジトリは Apache License 2.0 の下で利用可能です。

ツールをダウンロード