B
今週中
Hack The Boxの「Nimbus」マシンを題材に、特権コンテナからホストOSへ脱出する手法を解説した記事です
📌 一言でいうと
Hack The Boxの「Nimbus」マシンを題材に、特権コンテナからホストOSへ脱出する手法を解説した記事です。SSRFを用いてクラウドメタデータを取得し、コード実行権限を得た後、Linuxカーネルのcore_pattern設定を悪用してホスト上でroot権限のスクリプトを実行させるプロセスが詳述されています。コンテナの過剰な権限設定がもたらすリスクを実証しています。
🔍該当判定
- Dockerコンテナを「--privileged」オプション(特権モード)で起動して運用している
- クラウド環境(AWS/Azure/GCP等)で、コンテナからホストOSへアクセス可能な設定になっている
- 外部からアクセス可能なアプリケーションで、SSRF(サーバーサイドリクエストフォージェリ)の脆弱性が存在する
- コンテナ内でメモリダンプ設定(core_pattern)をホスト側と共有・変更できる権限を与えている
上記いずれにも該当しない → 静観でOK
✅該当時の対応
1. コンテナを '--privileged' フラグ付きで実行することを避け、最小権限の原則を適用すること。 2. ホストの /proc/sys/kernel/core_pattern などの機密性の高いカーネルパラメータへの書き込み権限を制限すること。 3. SSRF脆弱性を排除するため、入力値の検証と内部メタデータエンドポイントへのアクセス制限を徹底すること。
📧 メール案を見る (管理者向け)
⚠️ これは AI が生成した参考例です。配信前に必ず内容をご確認のうえ、貴社の状況に合わせて編集してご利用ください。実際の被害状況や自社の利用環境を踏まえた判断は、貴社のセキュリティ責任者にご確認ください。
件名: 【共有】特権コンテナからのホスト脱出手法(core_pattern悪用)について
お疲れさまです。特権コンテナの脆弱な設定を悪用したホストOSへの権限昇格手法に関する情報共有です。
■ 概要
コンテナが特権モード(--privileged)で動作している場合、攻撃者がホストの /proc/sys/kernel/core_pattern を書き換えることで、プロセスクラッシュ時に任意のスクリプトをホスト上のroot権限で実行させることが可能です。本事例ではSSRFからコード実行、そしてコンテナ脱出までの一連の攻撃チェーンが示されています。
■ 影響範囲
- 特権モードで動作しているDocker/Kubernetesコンテナ
- 不適切に設定されたLinuxカーネルパラメータを持つホスト
■ 対応手順
1. 運用中のコンテナに '--privileged' 設定が不要に適用されていないか確認し、可能な限り削除する。
2. AppArmorやSELinuxなどのセキュリティプロファイルを適用し、コンテナからホストの機密ファイルへのアクセスを制限する。
3. クラウド環境において、インスタンスメタデータサービス(IMDSv2等)へのアクセス制限を強化し、SSRFによる情報漏洩を防止する。
■ 参考情報
- Linux Kernel core_pattern documentation
対応優先度: 中
対応期限: 次回定期メンテナンス時まで
お疲れさまです。特権コンテナの脆弱な設定を悪用したホストOSへの権限昇格手法に関する情報共有です。
■ 概要
コンテナが特権モード(--privileged)で動作している場合、攻撃者がホストの /proc/sys/kernel/core_pattern を書き換えることで、プロセスクラッシュ時に任意のスクリプトをホスト上のroot権限で実行させることが可能です。本事例ではSSRFからコード実行、そしてコンテナ脱出までの一連の攻撃チェーンが示されています。
■ 影響範囲
- 特権モードで動作しているDocker/Kubernetesコンテナ
- 不適切に設定されたLinuxカーネルパラメータを持つホスト
■ 対応手順
1. 運用中のコンテナに '--privileged' 設定が不要に適用されていないか確認し、可能な限り削除する。
2. AppArmorやSELinuxなどのセキュリティプロファイルを適用し、コンテナからホストの機密ファイルへのアクセスを制限する。
3. クラウド環境において、インスタンスメタデータサービス(IMDSv2等)へのアクセス制限を強化し、SSRFによる情報漏洩を防止する。
■ 参考情報
- Linux Kernel core_pattern documentation
対応優先度: 中
対応期限: 次回定期メンテナンス時まで
Subject: [Technical Share] Host Escape from Privileged Containers via core_pattern
Hi team,
I am sharing technical details regarding a method to escape privileged containers and gain root access on the host OS.
■ Overview
When a container is run in privileged mode, an attacker can overwrite the host's /proc/sys/kernel/core_pattern. By triggering a process crash, the kernel will execute a specified handler script as root on the host. This attack chain typically starts with an initial entry point such as SSRF to gain credentials and code execution within the container.
■ Scope
- Docker/Kubernetes containers running with the '--privileged' flag.
- Hosts with insecure kernel parameter configurations.
■ Mitigation Steps
1. Audit all running containers and remove the '--privileged' flag where it is not strictly necessary.
2. Implement security profiles (e.g., AppArmor, SELinux) to restrict container access to sensitive host paths.
3. Enforce IMDSv2 or similar protections to mitigate SSRF attacks targeting cloud metadata.
■ Reference
- Linux Kernel core_pattern documentation
Priority: Medium
Deadline: Next scheduled maintenance window
Hi team,
I am sharing technical details regarding a method to escape privileged containers and gain root access on the host OS.
■ Overview
When a container is run in privileged mode, an attacker can overwrite the host's /proc/sys/kernel/core_pattern. By triggering a process crash, the kernel will execute a specified handler script as root on the host. This attack chain typically starts with an initial entry point such as SSRF to gain credentials and code execution within the container.
■ Scope
- Docker/Kubernetes containers running with the '--privileged' flag.
- Hosts with insecure kernel parameter configurations.
■ Mitigation Steps
1. Audit all running containers and remove the '--privileged' flag where it is not strictly necessary.
2. Implement security profiles (e.g., AppArmor, SELinux) to restrict container access to sensitive host paths.
3. Enforce IMDSv2 or similar protections to mitigate SSRF attacks targeting cloud metadata.
■ Reference
- Linux Kernel core_pattern documentation
Priority: Medium
Deadline: Next scheduled maintenance window