contrib/apparmor: profile name goes into peer rules as a pattern

オープン
#14,693 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
61/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, linux
領域
security

調査の方向性

Start by reading the default AppArmor template and the Go apparmor.WithDefaultProfile option mentioned in the issue; trace how the caller-supplied profile name reaches peer= rules. Check how AppArmor handles pattern characters and whether the name should be validated or escaped. Done means a profile name cannot broaden peer access, with a regression test covering a glob character.

索引モデルが issue の本文から書いたものです。

説明

Description

The default AppArmor template puts the profile name into its peer= rules as is. AppArmor reads that value as a pattern, so a name with a glob character allows signal and ptrace to more peers than the profile itself.

CRI is not affected, it always passes the constant cri-containerd.apparmor.d. The name is caller-supplied in two places: ctr run --apparmor-default-profile <name> and any Go caller of apparmor.WithDefaultProfile.

Steps to reproduce the issue

I did not run this through ctr. The profiles below are hand-written and copy the signal rule from the template.

  1. Load three profiles:

    profile stktest-exact flags=(attach_disconnected) {
      file,
      capability,
      signal (send,receive) peer=stktest-exact,
    }
    profile stktest* flags=(attach_disconnected) {
      file,
      capability,
      signal (send,receive) peer=stktest*,
    }
    profile stktest-other flags=(attach_disconnected) {
      file,
      capability,
      signal,
    }
    
  2. Start a process under the third one: aa-exec -p stktest-other -- sleep 15

  3. Signal it from each of the other two: aa-exec -p <profile> -- kill -0 <pid>

Describe the results you received and expected
sender profile signal to stktest-other
stktest-exact denied
stktest* allowed

I expected both to be denied: a profile generated from the template should only reach peers that carry its own name.

What version of containerd are you using?

No containerd binary was involved. I read the template on main at 9f3f084b43b2.

Any other relevant information

Ubuntu 26.04, kernel 7.0.0-44-generic, AppArmor parser 5.0.2.

Impact is low: the default names are fixed, and an operator has to pick such a name on purpose. Still, loadData could reject names with pattern characters, or escape them. I can send a PR for either.

Show configuration if it is related to CRI plugin.

Not related to CRI.

主要言語
Go
スター
21.6k
フォーク
4.2k
平均マージ
2日 9時間
マージ済み PR(30日)
86

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

containerd/containerd のほかの issue

containerd/containerd の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。