Skip to content

Investigate registry address-policy enforcement at the Docker pull boundary #351

Closed

Description

@samuelmbabhazi

Question to resolve

The control plane checks the resolved registry address, but passes the registry hostname through to the agent and Docker daemon, which resolves and connects from the node. Establish whether differing or changing DNS answers, redirects or authentication challenges can make the node contact a destination prohibited by the registry policy.

This is an investigation/hardening task, not a confirmed end-to-end SSRF exploit. No metadata read, credential theft or remote code execution was demonstrated. TLS and the OCI protocol constrain what a changed destination can serve.

Evidence

At c761e67d1aad834679cfae5569f8722e74084f4d, the resolver validates the hostname's current answers and returns an image reference retaining the hostname. A local test confirms that directly private-address digest references are rejected, while an accepted public hostname remains in the output. The Docker adapter delegates the pull to Docker without an address-policy parameter.

Private authenticated registries are implemented by #325; that does not itself prove this address-policy continuity.

Acceptance criteria

  • Use an isolated DNS/TLS/registry lab to vary answers between control-plane validation and node pull, and observe the daemon's actual destination.
  • Cover redirect and token-authentication endpoints and document TLS/certificate constraints.
  • If prohibited connections are possible, propose enforcement at the actual connection boundary with a regression test; otherwise document the demonstrated protection and close with evidence.
  • Preserve working public registries and keep any private-network exception explicit and reviewed.

Activity

  1. samuelmbabhazi commented on Nov 19, 2026

    @samuelmbabhazi
    CollaboratorAuthor

    Resolved by ADR 0023 (#368) and its implementation: #369 (egress proxy), #370 (agent check before each pull) and #371 (installer and loopback guard).

    What the lab showed

    The lab ran on a real node: Docker Engine 29.10.0 with the containerd image store, a fake HTTPS registry with a valid certificate for its name, and plain HTTP probes on 127.0.0.1 and on a private address. Without the change, the daemon reached destinations the control plane's policy forbids:

    1. it resolves the registry name again at pull time and pulls from a private address;
    2. it follows a blob redirect to http://127.0.0.1:… or http://192.168.… in plain HTTP;
    3. it calls a Bearer token service (realm) on those addresses in plain HTTP;
    4. it opens a TCP connection, with a TLS handshake, to any port of a name that resolves to loopback (no HTTP fallback on 29.x).

    These are blind requests, but a closed port and an open one give different failure causes. TLS limits only case 1, for services that answer TLS with a certificate for the attacker's name.

    Enforcement at the connection boundary

    • Egress proxy: the daemon pulls through shipkeep-egress on 127.0.0.1:7480. The proxy serves CONNECT only, connects only to public addresses (the control plane's ranges, kept identical by a test), and checks the address its dialer connects to.
    • Loopback guard: Go never proxies loopback literals, so an nftables table rejects new connections from the Docker daemon to loopback, except to the proxy and the local resolvers on port 53. The daemon runs in shipkeep.slice, so the guard is loaded before dockerd starts and in the same transaction as any nftables ruleset at start, reload and stop.
    • Check before each pull: the agent reads the daemon's proxy settings and refuses to pull (egress_unguarded) unless they are exactly the proxy's. daemon.json proxy settings are refused at install.

    Regression tests: proxy unit tests (malicious targets, non-public answers, plain HTTP, bounds, shutdown), pull-check tests, and installer tests (resolver parsing, guard rules, refused cgroups, daemon.json, /info).

    Results on the lab node after the change

    • A pull from Docker Hub went through the proxy, including the redirect to its CDN.
    • The four attack registries were refused at the proxy, and the probes received nothing.
    • A deployment from the control plane succeeded.
    • From the daemon's cgroup, loopback stayed refused after Docker restarts, after each nftables start, reload, restart and stop, and after reboots.
    • A later NO_PROXY=* stopped the next deployment before any download.

    Private registries

    Private-network registries stay unsupported, as before (SPEC 16): an exception would be an explicit server setting, reviewed like any change to this policy.

    Existing servers

    A server installed before this change needs to be installed again to get the proxy and the guard. docs/INSTALL.md says so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions