4

A developer running Docker for Windows needs to enable the option "Expose daemon on tcp://localhost:2375 without TLS" in Docker setting > General tab. enter image description here

There is a warning:

Exposing daemon on TCP without TLS helps legacy clients connect to the daemon. It also makes yourself vulnerable to remote code execution attacks. Use with caution.

My questions are:

  • What are the risks of enabling docker daemon on localhost?
  • Is there some mitigations?
Ortomala Lokni
  • 141
  • 1
  • 8
  • 1
    See also [Well, That Escalated Quickly! How Abusing Docker APILed to Remote Code Execution, Same Origin Bypass and Persistence in The Hypervisor via Shadow Containers](https://www.blackhat.com/docs/us-17/thursday/us-17-Cherny-Well-That-Escalated-Quickly-How-Abusing-The-Docker-API-Led-To-Remote-Code-Execution-Same-Origin-Bypass-And-Persistence_wp.pdf) – Sjoerd Mar 21 '19 at 09:46

1 Answers1

4

If you expose the Docker daemon without authentication (which is what that options does) then anyone who can make HTTP requests to localhost:2375 will be able to execute Docker commands on your host (the Docker daemon is a REST API so takes HTTP commands)

The consequences of that could be bad depending on the setup in question. For example an attacker could start a container which would connect back to a system controlled by them and allow access to your internal network.

An attacker could also start a container which maps in directories from the underlying host into the container that they control.

How probable these scenarios are, depends on your exact threat model, but that's the kind of thing that could occur.

As to mitigations, you can configure the Docker Daemon to use client certificate authentication via a TLS cert, some more information about setting that up here

Of course that might not work for whatever tooling your developer needs to use.

An alternative options (assuming that it's Linux containers under development rather than windows containers) is that you could use Visual Studio Code's ability to develop against a remote docker instance (more info here )

Rory McCune
  • 60,923
  • 14
  • 136
  • 217