Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Low] setupImageVolumes builds host mount paths from vol.Name without a containment check

オープン 初心者向け
#2,919 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@abhisheksharma2411 がすでに取り組んでいます。

2026年10月20日 から。

  • #3024 @abhisheksharma2411 による — オープン

評価

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

調査の方向性

internal/imagecache/bundle_linux.go の setupImageVolumes と、ImageVolumeMountPath および createExtraDirs の検証パターンについて internal/imagecache/spec.go を読んでください。ボリューム名がこの関数にどのように渡されるかを確認し、マウントパスを構築する前に包含チェックを追加してください。非ローカル名が拒否され、有効なボリューム名は引き続き機能すれば完了です。payload にはテストファイル名が記載されていません。

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

説明

area/security kind/bug

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:

  1. Both ateapi (cmd/ateapi/internal/apivalidation/zz_generated.validation.go#L9511) and atelet (cmd/atelet/internal/apivalidation/zz_generated.validation.go#L4448) enforce validate.ShortName (content.IsDNS1123Label), rejecting slashes and .. traversal sequences in volume names at API ingress.
  2. rootfs-overlay.json is generated by atelet on 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 malicious rootfs-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 (SystemInfoVolumeSource path 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

環境構築

はじめの一歩

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

agent-substrate/substrate のほかの issue

agent-substrate/substrate の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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