CRITICAL: Volume mounts allow access to any host path (Docker socket, /etc/shadow, etc.) #111

Closed
opened 2026-02-20 13:50:31 +01:00 by clawbot · 1 comment
Collaborator

Summary

Users can mount any absolute path on the host into their containers. The ValidateVolumePath function only checks that the path is absolute and clean — it does NOT restrict which paths are allowed.

Location

  • internal/handlers/app.goHandleVolumeAdd(), HandleVolumeEdit(), validateVolumePaths()
  • internal/handlers/app.goValidateVolumePath() (only checks absolute + clean)

Impact

An authenticated user can:

  1. Mount /var/run/docker.sockfull Docker API access = host root
  2. Mount /etc/shadow → read password hashes
  3. Mount / → read/write entire host filesystem
  4. Mount other apps' data directories → cross-tenant data access
  5. Mount /proc or /sys → container escape vectors

This is the most severe security issue for a PaaS platform.

Current Code

func ValidateVolumePath(p string) error {
    if p == "" { return ErrVolumePathEmpty }
    if !filepath.IsAbs(p) { return ErrVolumePathNotAbsolute }
    cleaned := filepath.Clean(p)
    if cleaned != p { return ErrVolumePathNotClean }
    return nil  // ANY absolute path is accepted!
}

Suggested Fix

Option A (Recommended): Restrict host paths to a configured base directory

func ValidateVolumePath(p string, allowedBase string) error {
    // ... existing checks ...
    // Host paths must be under the allowed base
    if !strings.HasPrefix(filepath.Clean(p), filepath.Clean(allowedBase)) {
        return ErrVolumePathOutsideAllowed
    }
    return nil
}

Add UPAAS_VOLUME_BASE_DIR config (e.g., /var/lib/upaas/volumes/) and restrict all host volume mounts to be under that directory.

Option B: Explicit deny list for dangerous paths (/var/run/docker.sock, /proc, /sys, /etc, /root, etc.) — less secure but simpler.

Option C: Use Docker named volumes instead of bind mounts — most secure, avoids host path access entirely.

Severity

CRITICAL — This is a trivially exploitable host compromise via the web UI or API.

## Summary Users can mount **any absolute path** on the host into their containers. The `ValidateVolumePath` function only checks that the path is absolute and clean — it does NOT restrict which paths are allowed. ## Location - `internal/handlers/app.go` — `HandleVolumeAdd()`, `HandleVolumeEdit()`, `validateVolumePaths()` - `internal/handlers/app.go` — `ValidateVolumePath()` (only checks absolute + clean) ## Impact An authenticated user can: 1. Mount `/var/run/docker.sock` → **full Docker API access = host root** 2. Mount `/etc/shadow` → read password hashes 3. Mount `/` → read/write entire host filesystem 4. Mount other apps' data directories → **cross-tenant data access** 5. Mount `/proc` or `/sys` → container escape vectors This is the most severe security issue for a PaaS platform. ## Current Code ```go func ValidateVolumePath(p string) error { if p == "" { return ErrVolumePathEmpty } if !filepath.IsAbs(p) { return ErrVolumePathNotAbsolute } cleaned := filepath.Clean(p) if cleaned != p { return ErrVolumePathNotClean } return nil // ANY absolute path is accepted! } ``` ## Suggested Fix Option A (Recommended): **Restrict host paths to a configured base directory** ```go func ValidateVolumePath(p string, allowedBase string) error { // ... existing checks ... // Host paths must be under the allowed base if !strings.HasPrefix(filepath.Clean(p), filepath.Clean(allowedBase)) { return ErrVolumePathOutsideAllowed } return nil } ``` Add `UPAAS_VOLUME_BASE_DIR` config (e.g., `/var/lib/upaas/volumes/`) and restrict all host volume mounts to be under that directory. Option B: **Explicit deny list** for dangerous paths (`/var/run/docker.sock`, `/proc`, `/sys`, `/etc`, `/root`, etc.) — less secure but simpler. Option C: **Use Docker named volumes instead of bind mounts** — most secure, avoids host path access entirely. ## Severity **CRITICAL** — This is a trivially exploitable host compromise via the web UI or API.
Owner

WONTFIX, working as intended

WONTFIX, working as intended
sneak closed this issue 2026-02-20 14:28:44 +01:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/upaas#111