Skip to content

Instantly share code, notes, and snippets.

@vierbergenlars
Last active July 20, 2019 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vierbergenlars/d5877cf8bb076fb5789f47d1ad7039fb to your computer and use it in GitHub Desktop.
Save vierbergenlars/d5877cf8bb076fb5789f47d1ad7039fb to your computer and use it in GitHub Desktop.

Breaking consul DNS with dnsmasq forwarding

Reproduction steps

  1. docker-compose up
  2. Find the UDP port that dnsmasq is listening on (docker ps)
  3. Send a DNS query.
    1. dig @127.0.0.1 -p <dnsmasq port> A consul.service.consul (This works and resolves to 127.0.0.1)
    2. dig @127.0.0.1 -p <dnsmasq port> DS consul.service.consul (This does not work and times out in dig)
  4. Have a look at your consul and dnsmasq logs. You have now succesfully DoS'ed consul and dnsmasq DNS.
port=53
bind-interfaces
server=/consul/10.33.10.2#8600
server=8.8.8.8
no-resolv
version: '2.2'
services:
consul:
image: consul:1.5.2
command: consul agent -server -bootstrap -bootstrap-expect=1 -recursor=10.33.10.3 -client=0.0.0.0 -data-dir=/consul/data -ui -dev
ports:
- 8500
networks:
default:
ipv4_address: 10.33.10.2
dnsmasq:
image: programster/dnsmasq
networks:
default:
ipv4_address: 10.33.10.3
ports:
- 53/udp
volumes:
- ./dnsmasq.conf:/etc/dnsmasq.conf:ro
networks:
default:
driver: bridge
ipam:
config:
- subnet: 10.33.10.0/24
gateway: 10.33.10.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment