---
title: Bidirectional bind propagation
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Infrastructure as Code (IaC)
  Security > IaC Security Rules > Bidirectional bind propagation
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Bidirectional bind propagation

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**Id:** `dockercompose-bidirectional-bind-propagation` 

**Platform:** DockerCompose

**Severity:** High

**Category:** Access Control

#### Learn More{% #learn-more %}

- [Provider Reference](https://docs.docker.com/reference/compose-file/services/#volumes)

### Description{% #description %}

Bidirectional bind mount propagation modes (`shared`, `rshared`) allow mount and unmount events in a container's bind mount to propagate back to the host or to other containers, enabling unintended cross-container data sharing and potential information disclosure. Bind mounts in the `volumes` list should use `private`, `rprivate`, `slave`, or `rslave` propagation to prevent container events from reaching the host. Volume entries specifying `shared` or `rshared` in the mount options will be flagged.

## Compliant Code Examples{% #compliant-code-examples %}

```yaml
services:
  private_bind:
    image: alpine
    volumes:
      - type: bind
        source: /srv/data
        target: /data
        bind:
          propagation: private
  named_lookalike:
    image: alpine
    volumes: ['data:/data:shared']
  one_way_propagation:
    image: alpine
    volumes:
      - /srv/cache:/cache:rslave
      - type: bind
        source: /srv/logs
        target: /logs
        bind:
          propagation: slave
volumes:
  data: {}
```

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```yaml
services:
  long_shared:
    image: alpine
    volumes:
      - type: bind
        source: /srv/data
        target: /data
        bind:
          propagation: rshared
  named_shared:
    image: alpine
    volumes: ['hostproc:/data:rshared']
  relative_dot_shared:
    image: alpine
    volumes: ['.:/data:rshared']
  named_rbind_shared:
    image: alpine
    volumes: ['hostetc:/data:rshared']
  named_driver_opts_shared:
    image: alpine
    volumes: ['hostvar:/data']
volumes:
  hostproc:
    driver_opts:
      type: none
      o: bind
      device: /proc
  hostetc:
    driver_opts:
      type: none
      o: rbind
      device: /etc
  hostvar:
    driver_opts:
      type: none
      o: bind,rshared
      device: /var/run
```
