Shared Host Network Namespace

  • Query id: 071a71ff-f868-47a4-ac0b-3c59e4ab5443
  • Query name: Shared Host Network Namespace
  • Platform: DockerCompose
  • Severity: Medium
  • Category: Resource Management
  • URL: Github

Description

Container should not share the host network namespace
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - yaml file
version: '2'

volumes:
  dhcp-leases:
    external: false

services:

  mongo: # 27017
    image: mongo:latest
    network_mode: "host"
    privileged: true

Code samples without security vulnerabilities

Negative test num. 1 - yaml file
version: '2'

volumes:
  dhcp-leases:
    external: false

services:

  mongo: # 27017
    image: mongo:latest
    network_mode: "none"
    privileged: true