[Low] guestVolumeSource can map host paths containing ".." outside the microVM guest share
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza por guestVolumeSource en internal/ocispec/microvm.go e inspecciona cómo su comparación de prefijos y path.Join gestionan las rutas relativas que contienen ... Añade una validación que mantenga las rutas asignadas dentro del recurso compartido del invitado y rechace un prefijo de staging vacío. Revisa las pruebas existentes para ShapeMicroVM o guestVolumeSource y añade cobertura para la traversal y las rutas staged válidas; el trabajo estará terminado cuando se rechace la traversal y las rutas válidas sigan asignándose correctamente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
In internal/ocispec/microvm.go, guestVolumeSource translates host volume bind mount sources into in-guest paths under GuestSharedDir using strings.CutPrefix followed by path.Join. It does not validate that the prefix is non-empty or check whether the trimmed relative path contains .. traversal segments, allowing paths to escape GuestSharedDir.
Details
In internal/ocispec/microvm.go#L124-L136:
func guestVolumeSource(hostPath string, actorDirs *ateworkerpb.ActorDirs, containerName string) (string, error) {
for _, staged := range []struct{ host, guest string }{
{actorDirs.GetDurableDirVolumeMountsDir(), path.Join(GuestSharedDir, ShareDurable)},
{actorDirs.GetExternalVolumeMountsDir(), path.Join(GuestSharedDir, ShareCSI)},
{actorDirs.GetSystemInfoVolumeRootsDir(), path.Join(GuestSharedDir, ShareSystemInfo)},
{imagecache.ImageVolumeMountPath(filepath.Join(actorDirs.GetOciBundleDir(), containerName), ""), path.Join(GuestSharedDir, GuestContainerID(containerName), ShareVolumes)},
} {
if rel, ok := strings.CutPrefix(hostPath, staged.host+"/"); ok {
return path.Join(staged.guest, rel), nil
}
}
return "", fmt.Errorf("host path %q is not staged into the guest share", hostPath)
}
Because path.Join performs lexical path resolution via path.Clean, passing a hostPath such as staged.host + "/../../../../../dev/vda" succeeds in strings.CutPrefix and cleans the joined path to /dev/vda, escaping GuestSharedDir (/run/kata-containers/shared/containers).
Impact
At the unit level, an unvalidated OCI spec passed to ShapeMicroVM can map host bind mounts to arbitrary guest device or filesystem nodes outside the virtio-fs shared directory. However, in production, ShapeMicroVM is only called by cmd/ateworker-microvm/run.go on specs generated by ocispec.Build. Volume and container names are validated as DNS-1123 labels (validate.ShortName), and host directory paths are validated as clean absolute paths (resources.ValidateActorDirs), preventing traversal sequences from reaching guestVolumeSource. The issue is therefore a defense-in-depth and hardening defect rather than an exploitable vulnerability.
Suggested fix
Validate that the relative path does not escape the target directory using filepath.Rel and filepath.IsLocal (or path.IsLocal), and verify that staged.host is non-empty before prefix matching.
Related
- Closed issue #1436:
SystemInfoVolumeSourceaccepts path traversal (e.g.../)
- Lenguaje dominante
- Go
- Estrellas
- 5.7k
- Forks
- 612
- Merge medio
- 2 d 14 h
- PR fusionados (30 d)
- 533
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de agent-substrate/substrate
-
[Low] CSI plugin builds staging directories from storage_volume_id without a containment checkAbiertoarea/security kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
agent-substrate/substrate#2935 ·
Los mantenedores suelen responder en 1 día
-
area/security kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
agent-substrate/substrate#2932 ·
Los mantenedores suelen responder en 1 día
-
[Low] setupImageVolumes builds host mount paths from vol.Name without a containment checkPosiblemente ocupada @abhisheksharma2411 la tomó hace 1 día. Abiertoarea/security kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
agent-substrate/substrate#2919 ·
Los mantenedores suelen responder en 1 día
-
[Low] ate-api-server accepts client certificates chained to system roots when --pod-identity-ca-certs is unsetPosiblemente ocupada @abhisheksharma2411 la tomó hace 1 día. Abiertoarea/security kind/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
agent-substrate/substrate#2918 ·
Los mantenedores suelen responder en 1 día
-
Cloud SQL backend: document (and optionally provision) Private Service Connect for ATE_API_POSTGRES_CLOUDSQL_IP_TYPE=pscPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea/dev-infra kind/docs kind/feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
agent-substrate/substrate#2875 ·
Los mantenedores suelen responder en 1 día
Todos los issues de agent-substrate/substrate
Issues similares
-
Mend: dependency security vulnerability
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
kube-tarian/sigrun#202 ·
-
question raised-by:verifier
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
medici-finance/assay#4013 ·
Los mantenedores suelen responder en 1 día
-
TestRegistry_ConcurrentMixedOperations fetches from the network and can hang the short suiteAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
tsukumogami/tsuku#2775 ·
Los mantenedores suelen responder en 1 día
-
automation models
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
Los mantenedores suelen responder en 1 día