SlideShare a Scribd company logo
1 of 11
MITRE ATT&CK - T1611
Privilege Escalation
Escape to Host
May 24, 2021 kataokaw
T1611 - Escape to Hostの立ち位置
MITRE ATT&CKマトリックスでの立ち位置
a
TACTICS - Privilege Escalation (TA0004)
ATT&CKマトリックスの列名「Privilege Escalation」は、
攻撃者がシステムまたはネットワークにおいて、
より高いレベルのアクセス権を取得するために使用する手法で構成されている。
一般的なアプローチは、システムの弱点/構成の誤り/脆弱性の利用とされている。
権限昇格後に利用される権限の例
 SYSTAM/root
 local administrator
 管理者のようなアクセス権を持つユーザーアカウント
 特定システムへのアクセスや、特定機能を実行するユーザーアカウント
[MITER ATT&CK TACTICS (Enterprise) – Privilege Escalation] https://attack.mitre.org/tactics/TA0004/
TECHNIQUES - Escape to Host (T1611)
ID 名前
T1548 - 不正な昇格制御機構
.001 SetuidとSetgid
.002 ユーザーアカウント制御のバイパス
.003 SudoとSudoキャッシング
.004 プロンプトによる高度な実行
.010 ポートモニタ
.011 Plistの変更
.012 プリントプロセッサ
.013 XDG オートスタートの入力
.014 アクティブセットアップ
~省略~
T1611 ホストへのエスケープ
~省略~
「Privilege Escalation」には、
13のテクニックと82のサブテクニックがあるが、今回はT1611にフォーカスする。
[MITER ATT&CK TACTICS (Enterprise) – Privilege Escalation] https://attack.mitre.org/tactics/TA0004/
TECHNIQUES - Escape to Host (T1611)
T1611の詳細
攻撃者はコンテナを抜け出し、基盤となるホストにアクセスすることがあります。
これにより、攻撃者は、ホスト層から他のコンテナ化されたリソースへのアクセスや、ホスト自体へのアクセスが可能になります。
原則、コンテナ化されたリソースは、アプリの機能を明確に分離し、ホスト環境から隔離されている必要があります。
攻撃者が、ホスト環境へ抜け出す方法は複数あります。
bindパラメータを利用してホストのFSをマウントするよう構成したコンテナを作成し、
ホスト上で、ペイロードのダウンロードや、制御ユーティリティ(cron等)の実行などができます。
また、特権付きのコンテナを利用して、基盤となるホスト上でコマンドを実行することもできます。
ホストにアクセスできるようになると、
攻撃者は、永続性の確立、環境内での横移動、ホスト上でのC&Cチャネルの設定など、
次の目的を達成する機会を得ることができます。
->コンテナに何かしらの権限を付与する機会は無いのか?
[MITER ATT&CK TECHNIQUES (Enterprise) –Escape to Host] https://attack.mitre.org/techniques/T1611/
Dockerコンテナの権限を変更する事例
 openvpnの利用
「ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)」
”Linux capabilities”の「CAP_NET_ADMIN」が必要なので、オプション「--cap-add NET_ADMIN」を使用する。
 mountの利用
「mount: permission denied」
”Linux capabilities”の「CAP_SYS_ADMIN」が必要なので、オプション「--cap-add SYS_ADMIN」を使用する。
tmpfsのマウント等では、下記エラーが出力されるが、
オプション「--security-opt apparmor:unconfined」か、AppArmorのカスタムプロファイルで回避可能とのこと。
「mount: tmpfs is write-protected, mounting read-only
mount: cannot mount tmpfs read-only」
コンテナ起動コマンドの例
docker run --cap-add NET_ADMIN --cap-add SYS_ADMIN --name <C-NAME> -itd -p <HOST-PORT>:<C-
PORT> <REPO-NAME>:<TAG-NAME>
[Linux capabilities] https://man7.org/linux/man-pages/man7/capabilities.7.html
[Google Cloud Platform - AppArmor によるコンテナの保護] https://cloud.google.com/container-optimized-os/docs/how-to/secure-apparmor?hl=ja
権限付与の事例 コンテナの起動時のオプションで各種権限が
付与できるが、その分リスクも高まるので注意。
特権でコンテナを
起動したらどうなるの?
Dockerコンテナを特権で実行
[情シスNavi. - セキュリティブログ:Dockerコンテナを特権モードで実行することが危険な理由]
https://josys-navi.hiblead.co.jp/tmsb_21jan20_docker-in-docker
[paloalto - コンテナでプログラムをrootとして実行することがなぜ問題なのか KubernetsのCVE-2019-11245を例に考える]
https://unit42.paloaltonetworks.jp/non-root-containers-kubernetes-cve-2019-11245-care/
特権コンテナを起動した際のリスク
特権コンテナは、ホストに対してルート権限を備えたコンテナのため、
コンテナ内のユーザは、ホストのリソースへの高度なアクセス権限を持つことになる。
よって、考えられるリスクは下記となる。
 AppArmor、 cgroups、SECcomp等のセキュリティ機構の無効化
 C&Cサーバの設定
 コンテナブレイクアウト(ホスト上のコマンド実行/バイナリ変更)
 システムファイルの変更
 特権プロセスの停止・起動
etc.
コンテナを対象とした攻撃ツール
脅威グループ「TeamTNT」は、下記ツールを利用していた。
 BotB
->一般的なコンテナの脆弱性を悪用し、コンテナブレイクアウトを実行する。
その結果として、ホストでのコマンド実行やバイナリの変更などが可能となる。
CVE-2019-5736を利用している。
 Peirates
->Peiratesは複数のインフラストラクチャとクラウドの資格情報を収集できる。
Kubernetesクラスタからサービスアカウントトークンを検索する際に使えるらしい。
[paloalto - Hildegard: Kubernetesを標的とする新たなTeamTNTのクリプトジャックマルウェア] https://unit42.paloaltonetworks.jp/hildegard-malware-teamtnt/
[Github -brompwnie/botb] https://github.com/brompwnie/botb
[Github - inguardians/peirates] https://github.com/inguardians/peirates
攻撃ツールの事例
どうやって防ぐのか
対策方法
[Github - brompwnie/botb] https://github.com/brompwnie/botb
[Paloalto - runCによるDockerコンテナブレークアウト: CVE-2019-5736の解説]https://unit42.paloaltonetworks.jp/breaking-docker-via-runc-explaining-cve-2019-5736/
[Qiita - Dockerコンテナを本番環境で使うためのセキュリティ設定] https://qiita.com/muff1225/items/4edea7b039dd9f26098f#root%E6%A8%A9%E9%99%90%E3%82%92%E5%89%A5%E5%A5%AA%E3%81%99%E3%82%8B
[docker-docs-ja] https://docs.docker.jp/engine/security/rootless.html
 信頼できる公開元のイメージのみ利用する/content trust機能を利用する(バックドアやファイルレスマルウェアの回避)
 特権コンテナを外部公開しない
 外部公開するコンテナには、不要な権限を付与しない(CAP_SYS_ADMINなど)
 外部公開するコンテナ内サービスは、特権で実行しない
->コンテナ起動オプション「-u <uid>」でUIDを指定する方法や、DockerfileのUserディレクティブ、KubernetesのSecurityContextを利用する。
 不要なコンテナ間通信を閉じる
->Docker daemon起動時に--icc=falseオプションを利用する
 コンテナにファイルをマウントする場合はRead-onlyを指定する
docker run -v .:/src/app:ro <C-ID>
 Docker自体や外部公開するコンテナ内のOSSを常にアップデートしておく(特にrunCなど)
 Docker-in-Dockerしない
 (番外)kubletへのAnonymousアクセスを禁止する
実験的なものではあるが、将来的にはRootless Dockerの利用が推奨されるかもしれない(Docker 19.03以降)。
なお、現時点ではcgroupを利用できないなどの制約がある。
おわり

More Related Content

Recently uploaded

デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)UEHARA, Tetsutaro
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...博三 太田
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案sugiuralab
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfFumieNakayama
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfFumieNakayama
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 

Recently uploaded (12)

デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
 
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察  ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
TataPixel: 畳の異方性を利用した切り替え可能なディスプレイの提案
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdfAWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdfクラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 

Featured

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

MITRE ATT&CK T1611 Escape to Host

  • 1. MITRE ATT&CK - T1611 Privilege Escalation Escape to Host May 24, 2021 kataokaw
  • 2. T1611 - Escape to Hostの立ち位置 MITRE ATT&CKマトリックスでの立ち位置 a
  • 3. TACTICS - Privilege Escalation (TA0004) ATT&CKマトリックスの列名「Privilege Escalation」は、 攻撃者がシステムまたはネットワークにおいて、 より高いレベルのアクセス権を取得するために使用する手法で構成されている。 一般的なアプローチは、システムの弱点/構成の誤り/脆弱性の利用とされている。 権限昇格後に利用される権限の例  SYSTAM/root  local administrator  管理者のようなアクセス権を持つユーザーアカウント  特定システムへのアクセスや、特定機能を実行するユーザーアカウント [MITER ATT&CK TACTICS (Enterprise) – Privilege Escalation] https://attack.mitre.org/tactics/TA0004/
  • 4. TECHNIQUES - Escape to Host (T1611) ID 名前 T1548 - 不正な昇格制御機構 .001 SetuidとSetgid .002 ユーザーアカウント制御のバイパス .003 SudoとSudoキャッシング .004 プロンプトによる高度な実行 .010 ポートモニタ .011 Plistの変更 .012 プリントプロセッサ .013 XDG オートスタートの入力 .014 アクティブセットアップ ~省略~ T1611 ホストへのエスケープ ~省略~ 「Privilege Escalation」には、 13のテクニックと82のサブテクニックがあるが、今回はT1611にフォーカスする。 [MITER ATT&CK TACTICS (Enterprise) – Privilege Escalation] https://attack.mitre.org/tactics/TA0004/
  • 5. TECHNIQUES - Escape to Host (T1611) T1611の詳細 攻撃者はコンテナを抜け出し、基盤となるホストにアクセスすることがあります。 これにより、攻撃者は、ホスト層から他のコンテナ化されたリソースへのアクセスや、ホスト自体へのアクセスが可能になります。 原則、コンテナ化されたリソースは、アプリの機能を明確に分離し、ホスト環境から隔離されている必要があります。 攻撃者が、ホスト環境へ抜け出す方法は複数あります。 bindパラメータを利用してホストのFSをマウントするよう構成したコンテナを作成し、 ホスト上で、ペイロードのダウンロードや、制御ユーティリティ(cron等)の実行などができます。 また、特権付きのコンテナを利用して、基盤となるホスト上でコマンドを実行することもできます。 ホストにアクセスできるようになると、 攻撃者は、永続性の確立、環境内での横移動、ホスト上でのC&Cチャネルの設定など、 次の目的を達成する機会を得ることができます。 ->コンテナに何かしらの権限を付与する機会は無いのか? [MITER ATT&CK TECHNIQUES (Enterprise) –Escape to Host] https://attack.mitre.org/techniques/T1611/
  • 6. Dockerコンテナの権限を変更する事例  openvpnの利用 「ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)」 ”Linux capabilities”の「CAP_NET_ADMIN」が必要なので、オプション「--cap-add NET_ADMIN」を使用する。  mountの利用 「mount: permission denied」 ”Linux capabilities”の「CAP_SYS_ADMIN」が必要なので、オプション「--cap-add SYS_ADMIN」を使用する。 tmpfsのマウント等では、下記エラーが出力されるが、 オプション「--security-opt apparmor:unconfined」か、AppArmorのカスタムプロファイルで回避可能とのこと。 「mount: tmpfs is write-protected, mounting read-only mount: cannot mount tmpfs read-only」 コンテナ起動コマンドの例 docker run --cap-add NET_ADMIN --cap-add SYS_ADMIN --name <C-NAME> -itd -p <HOST-PORT>:<C- PORT> <REPO-NAME>:<TAG-NAME> [Linux capabilities] https://man7.org/linux/man-pages/man7/capabilities.7.html [Google Cloud Platform - AppArmor によるコンテナの保護] https://cloud.google.com/container-optimized-os/docs/how-to/secure-apparmor?hl=ja 権限付与の事例 コンテナの起動時のオプションで各種権限が 付与できるが、その分リスクも高まるので注意。
  • 8. Dockerコンテナを特権で実行 [情シスNavi. - セキュリティブログ:Dockerコンテナを特権モードで実行することが危険な理由] https://josys-navi.hiblead.co.jp/tmsb_21jan20_docker-in-docker [paloalto - コンテナでプログラムをrootとして実行することがなぜ問題なのか KubernetsのCVE-2019-11245を例に考える] https://unit42.paloaltonetworks.jp/non-root-containers-kubernetes-cve-2019-11245-care/ 特権コンテナを起動した際のリスク 特権コンテナは、ホストに対してルート権限を備えたコンテナのため、 コンテナ内のユーザは、ホストのリソースへの高度なアクセス権限を持つことになる。 よって、考えられるリスクは下記となる。  AppArmor、 cgroups、SECcomp等のセキュリティ機構の無効化  C&Cサーバの設定  コンテナブレイクアウト(ホスト上のコマンド実行/バイナリ変更)  システムファイルの変更  特権プロセスの停止・起動 etc.
  • 9. コンテナを対象とした攻撃ツール 脅威グループ「TeamTNT」は、下記ツールを利用していた。  BotB ->一般的なコンテナの脆弱性を悪用し、コンテナブレイクアウトを実行する。 その結果として、ホストでのコマンド実行やバイナリの変更などが可能となる。 CVE-2019-5736を利用している。  Peirates ->Peiratesは複数のインフラストラクチャとクラウドの資格情報を収集できる。 Kubernetesクラスタからサービスアカウントトークンを検索する際に使えるらしい。 [paloalto - Hildegard: Kubernetesを標的とする新たなTeamTNTのクリプトジャックマルウェア] https://unit42.paloaltonetworks.jp/hildegard-malware-teamtnt/ [Github -brompwnie/botb] https://github.com/brompwnie/botb [Github - inguardians/peirates] https://github.com/inguardians/peirates 攻撃ツールの事例
  • 10. どうやって防ぐのか 対策方法 [Github - brompwnie/botb] https://github.com/brompwnie/botb [Paloalto - runCによるDockerコンテナブレークアウト: CVE-2019-5736の解説]https://unit42.paloaltonetworks.jp/breaking-docker-via-runc-explaining-cve-2019-5736/ [Qiita - Dockerコンテナを本番環境で使うためのセキュリティ設定] https://qiita.com/muff1225/items/4edea7b039dd9f26098f#root%E6%A8%A9%E9%99%90%E3%82%92%E5%89%A5%E5%A5%AA%E3%81%99%E3%82%8B [docker-docs-ja] https://docs.docker.jp/engine/security/rootless.html  信頼できる公開元のイメージのみ利用する/content trust機能を利用する(バックドアやファイルレスマルウェアの回避)  特権コンテナを外部公開しない  外部公開するコンテナには、不要な権限を付与しない(CAP_SYS_ADMINなど)  外部公開するコンテナ内サービスは、特権で実行しない ->コンテナ起動オプション「-u <uid>」でUIDを指定する方法や、DockerfileのUserディレクティブ、KubernetesのSecurityContextを利用する。  不要なコンテナ間通信を閉じる ->Docker daemon起動時に--icc=falseオプションを利用する  コンテナにファイルをマウントする場合はRead-onlyを指定する docker run -v .:/src/app:ro <C-ID>  Docker自体や外部公開するコンテナ内のOSSを常にアップデートしておく(特にrunCなど)  Docker-in-Dockerしない  (番外)kubletへのAnonymousアクセスを禁止する 実験的なものではあるが、将来的にはRootless Dockerの利用が推奨されるかもしれない(Docker 19.03以降)。 なお、現時点ではcgroupを利用できないなどの制約がある。