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

未关闭
#14,693 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 小时
30 天内合并 PR
86

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

containerd/containerd 的其他 Issue

查看 containerd/containerd 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。