Skip to content

Golang Misconfigured Interface Binding

What does this mean ?

Binding to all network interfaces can potentially open up a service to traffic on unintended interfaces, that may not be properly documented or secured. This plugin test looks for a string pattern “0.0.0.0” that may indicate a hardcoded binding to all network interfaces.

What can happen ?

The clustered setup of Apache MXNet allows users to specify which IP address and port the scheduler will listen on via the DMLC_PS_ROOT_URI and DMLC_PS_ROOT_PORT env variables. In versions older than 1.0.0, however, the MXNet framework will listen on 0.0.0.0 rather than user specified DMLC_PS_ROOT_URI once a scheduler node is initialized. This exposes the instance running MXNet to any attackers reachable via the interface they didn't expect to be listening on. For example: If a user wants to run a clustered setup locally, they may specify to run on 127.0.0.1. But since MXNet will listen on 0.0.0.0, it makes the port accessible on all network interfaces.

Recommendation

Avoid listening on all interfaces by default.

std::string hostname = node.hostname.empty() ? "*" : node.hostname;

std::string addr = local ? "ipc:///tmp/" : "tcp://" + hostname + ":";

Sample Code

Vulnerable :

package main
import (
    "log"
    "net"
)
func main() {
    line, err := net.Listen("tcp", "0.0.0.0:2000")
    if err != nil {
        log.Fatal(err)
    }
    defer line.Close()
}

References