Headline
CVE-2021-21382: ansible-restund/restund.conf.j2 at master · wireapp/ansible-restund
Restund is an open source NAT traversal server. The restund TURN server can be instructed to open a relay to the loopback address range. This allows you to reach any other service running on localhost which you might consider private. In the configuration that we ship (https://github.com/wireapp/ansible-restund/blob/master/templates/restund.conf.j2#L40-L43) the status
interface of restund is enabled and is listening on 127.0.0.1
.The status
interface allows users to issue administrative commands to restund
like listing open relays or draining connections. It would be possible for an attacker to contact the status interface and issue administrative commands by setting XOR-PEER-ADDRESS
to 127.0.0.1:{{restund_udp_status_port}}
when opening a TURN channel. We now explicitly disallow relaying to loopback addresses, ‘any’ addresses, link local addresses, and the broadcast address. As a workaround disable the status
module in your restund configuration. However there might still be other services running on 127.0.0.0/8
that you do not want to have exposed. The turn
module can be disabled. Restund will still perform STUN and this might already be enough for initiating calls in your environments. TURN is only used as a last resort when other NAT traversal options do not work. One should also make sure that the TURN server is set up with firewall rules so that it cannot relay to other addresses that you don’t want the TURN server to relay to. For example other services in the same VPC where the TURN server is running. Ideally TURN servers should be deployed in an isolated fashion where they can only reach what they need to reach to perform their task of assisting NAT-traversal.
# core
daemon no
debug no
realm dummy.io
syncinterval 600
udp_listen {{ hostvars[inventory_hostname][‘ansible_’ + restund_network_interface].ipv4.address }}:{{ restund_udp_listen_port }}
udp_sockbuf_size 524288
tcp_listen {{ hostvars[inventory_hostname][‘ansible_’ + restund_network_interface].ipv4.address }}:{{ restund_tcp_listen_port }}
{% if restund_tls_certificate is defined %}
tls_listen {{ hostvars[inventory_hostname][‘ansible_’ + restund_network_interface].ipv4.address }}:{{ restund_tls_listen_port }},/usr/local/etc/restund/restund.pem
{% endif %}
# modules
module_path /usr/local/lib/restund/modules
module stat.so
module drain.so
module binding.so
module auth.so
module turn.so
module zrest.so
module status.so
# auth
auth_nonce_expiry 3600
# turn
turn_max_allocations 64000
turn_max_lifetime 3600
turn_relay_addr {{ hostvars[inventory_hostname][‘ansible_’ + restund_network_interface].ipv4.address }}
{% if restund_peer_udp_advertise_addr is defined and hostvars[inventory_hostname][‘ansible_’ + restund_network_interface].ipv4.address != restund_peer_udp_advertise_addr %}
# turn_public_addr is an IP which must be reachable for UDP traffic from other restund servers (and from this server itself). If unset, defaults to ‘turn_relay_addr’
turn_public_addr {{ restund_peer_udp_advertise_addr }}
{% endif %}
# syslog
syslog_facility 24
# status
status_udp_addr 127.0.0.1
status_udp_port {{ restund_udp_status_port }}
status_http_addr 127.0.0.1
status_http_port {{ restund_http_status_port }}
# zrest
zrest_secret {{ restund_zrest_secret }}