[Low] setupImageVolumes builds host mount paths from vol.Name without a containment check
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
internal/imagecache/bundle_linux.go の setupImageVolumes と、ImageVolumeMountPath および createExtraDirs の検証パターンについて internal/imagecache/spec.go を読んでください。ボリューム名がこの関数にどのように渡されるかを確認し、マウントパスを構築する前に包含チェックを追加してください。非ローカル名が拒否され、有効なボリューム名は引き続き機能すれば完了です。payload にはテストファイル名が記載されていません。
索引モデルが issue の本文から書いたものです。
説明
Summary
In internal/imagecache/bundle_linux.go, setupImageVolumes constructs mount points using ImageVolumeMountPath(bundlePath, vol.Name) without verifying that vol.Name is a clean, local relative path. If a crafted rootfs-overlay.json containing path traversal sequences (such as ../) is processed, setupImageVolumes can create directories, unmount existing mounts, and mount image layers at arbitrary locations on the host within the privileged ateworker context.
Details
In internal/imagecache/bundle_linux.go#L114-L122:
mountpoint := ImageVolumeMountPath(bundlePath, vol.Name)
if err := os.MkdirAll(mountpoint, 0o700); err != nil {
return fmt.Errorf("while creating image volume mount point %q: %w", mountpoint, err)
}
_ = unix.Unmount(mountpoint, unix.MNT_DETACH)
if err := mountImageVolume(mountpoint, vol.Layers); err != nil {
return fmt.Errorf("while mounting image volume %q: %w", vol.Name, err)
}
And internal/imagecache/spec.go#L30-L32:
func ImageVolumeMountPath(bundlePath, volumeName string) string {
return filepath.Join(bundlePath, "volumes", volumeName)
}
In contrast to createExtraDirs (internal/imagecache/spec.go#L182-L184), which uses os.OpenRoot and enforces filepath.IsLocal, setupImageVolumes performs no checks on vol.Name.
Impact
Exploitability is constrained by upstream controls:
- Both
ateapi(cmd/ateapi/internal/apivalidation/zz_generated.validation.go#L9511) andatelet(cmd/atelet/internal/apivalidation/zz_generated.validation.go#L4448) enforcevalidate.ShortName(content.IsDNS1123Label), rejecting slashes and..traversal sequences in volume names at API ingress. rootfs-overlay.jsonis generated byateleton the host; untrusted sandboxed containers cannot modify it directly.
An attacker would require a pre-existing host-level compromise or a bypass of the API server validation to write a maliciousrootfs-overlay.json.
Suggested fix
Validate vol.Name in setupImageVolumes before joining paths, rejecting non-local paths or path separators:
if !filepath.IsLocal(vol.Name) || filepath.Base(vol.Name) != vol.Name {
return fmt.Errorf("invalid volume name %q: must be a local filename", vol.Name)
}
Related
- Related: #1436 (
SystemInfoVolumeSourcepath traversal validation) - Related: PR #923 (Added image volumes to ActorTemplate)
- Related: PR #2826 (Micro-VM image volumes refactor)
- 主要言語
- Go
- スター
- 5.7k
- フォーク
- 612
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 566
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
agent-substrate/substrate のほかの issue
-
area/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
agent-substrate/substrate#2935 ·
メンテナーはふだん 1 日以内に返信
-
[Low] CleanupSandboxState joins an unchecked id into paths it RemoveAll()s対応中かも @ericcurtin が今日担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agent-substrate/substrate#2932 ·
メンテナーはふだん 1 日以内に返信
-
[Low] guestVolumeSource can map host paths containing ".." outside the microVM guest share対応中かも @jiayimeow が 3 日前に担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
agent-substrate/substrate#2920 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[Low] ate-api-server accepts client certificates chained to system roots when --pod-identity-ca-certs is unset対応中かも @abhisheksharma2411 が 2 日前に担当しました。 オープンarea/security kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
agent-substrate/substrate#2918 ·
メンテナーはふだん 1 日以内に返信
-
Cloud SQL backend: document (and optionally provision) Private Service Connect for ATE_API_POSTGRES_CLOUDSQL_IP_TYPE=psc対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea/dev-infra kind/docs kind/feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
agent-substrate/substrate#2875 ·
メンテナーはふだん 1 日以内に返信
agent-substrate/substrate の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
FiloSottile/age#758 ·
-
nginx configオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信