Bug 2270591 (CVE-2024-29018) - CVE-2024-29018 moby: external DNS requests from 'internal' networks could lead to data exfiltration
Summary: CVE-2024-29018 moby: external DNS requests from 'internal' networks could lea...
Keywords:
Status: NEW
Alias: CVE-2024-29018
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 2270600 2270601 2270602 2270605 2270606 2270607 2270608 2270610 2270612 2270614 2270615 2270626 2270599 2270603 2270604 2270609 2270613
Blocks: 2270637
TreeView+ depends on / blocked
 
Reported: 2024-03-21 05:04 UTC by TEJ RATHI
Modified: 2024-04-24 12:28 UTC (History)
74 users (show)

Fixed In Version: moby 26.0.0-rc3, moby 25.0.5, moby 23.0.11
Doc Type: If docs needed, set a value
Doc Text:
A vulnerability was found in Moby due to excessive data output in external DNS requests from "internal" networks, enabling unauthorized access to sensitive system information by remote attackers. This flaw allows attackers to gain access to sensitive information by exploiting incorrect resource transfer between spheres through specially crafted requests.
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description TEJ RATHI 2024-03-21 05:04:54 UTC
Moby is an open source container framework that is a key component of Docker Engine, Docker Desktop, and other distributions of container tooling or runtimes. Moby's networking implementation allows for many networks, each with their own IP address range and gateway, to be defined. This feature is frequently referred to as custom networks, as each network can have a different driver, set of parameters and thus behaviors. When creating a network, the `--internal` flag is used to designate a network as _internal_. The `internal` attribute in a docker-compose.yml file may also be used to mark a network _internal_, and other API clients may specify the `internal` parameter as well.

When containers with networking are created, they are assigned unique network interfaces and IP addresses. The host serves as a router for non-internal networks, with a gateway IP that provides SNAT/DNAT to/from container IPs.

Containers on an internal network may communicate between each other, but are precluded from communicating with any networks the host has access to (LAN or WAN) as no default route is configured, and firewall rules are set up to drop all outgoing traffic. Communication with the gateway IP address (and thus appropriately configured host services) is possible, and the host may communicate with any container IP directly.

In addition to configuring the Linux kernel's various networking features to enable container networking, `dockerd` directly provides some services to container networks. Principal among these is serving as a resolver, enabling service discovery, and resolution of names from an upstream resolver.

When a DNS request for a name that does not correspond to a container is received, the request is forwarded to the configured upstream resolver. This request is made from the container's network namespace: the level of access and routing of traffic is the same as if the request was made by the container itself.

As a consequence of this design, containers solely attached to an internal network will be unable to resolve names using the upstream resolver, as the container itself is unable to communicate with that nameserver. Only the names of containers also attached to the internal network are able to be resolved.

Many systems run a local forwarding DNS resolver. As the host and any containers have separate loopback devices, a consequence of the design described above is that containers are unable to resolve names from the host's configured resolver, as they cannot reach these addresses on the host loopback device. To bridge this gap, and to allow containers to properly resolve names even when a local forwarding resolver is used on a loopback address, `dockerd` detects this scenario and instead forward DNS requests from the host namework namespace. The loopback resolver then forwards the requests to its configured upstream resolvers, as expected.

Because `dockerd` forwards DNS requests to the host loopback device, bypassing the container network namespace's normal routing semantics entirely, internal networks can unexpectedly forward DNS requests to an external nameserver. By registering a domain for which they control the authoritative nameservers, an attacker could arrange for a compromised container to exfiltrate data by encoding it in DNS queries that will eventually be answered by their nameservers.

Docker Desktop is not affected, as Docker Desktop always runs an internal resolver on a RFC 1918 address.

Moby releases 26.0.0, 25.0.4, and 23.0.11 are patched to prevent forwarding any DNS requests from internal networks. As a workaround, run containers intended to be solely attached to internal networks with a custom upstream address, which will force all upstream DNS queries to be resolved from the container's network namespace.

https://github.com/moby/moby/pull/46609
https://github.com/moby/moby/security/advisories/GHSA-mq39-4gv4-mvpx

Comment 1 TEJ RATHI 2024-03-21 05:41:58 UTC
Created apptainer tracking bugs for this issue:

Affects: epel-all [bug 2270599]
Affects: fedora-all [bug 2270604]


Created cri-tools tracking bugs for this issue:

Affects: fedora-all [bug 2270605]


Created kompose tracking bugs for this issue:

Affects: epel-all [bug 2270600]


Created manifest-tool tracking bugs for this issue:

Affects: epel-all [bug 2270601]


Created moby-engine tracking bugs for this issue:

Affects: fedora-all [bug 2270606]


Created osbuild-composer tracking bugs for this issue:

Affects: fedora-all [bug 2270607]


Created pack tracking bugs for this issue:

Affects: epel-all [bug 2270602]
Affects: fedora-all [bug 2270608]


Created singularity-ce tracking bugs for this issue:

Affects: epel-all [bug 2270603]
Affects: fedora-all [bug 2270609]


Created source-to-image tracking bugs for this issue:

Affects: fedora-all [bug 2270610]


Note You need to log in before you can comment on or make changes to this bug.