When multiple sockets are allowed to bind to the same port, other services on that port may be stolen or spoofed. 1000 Weakness ChildOf 675 1000 Weakness ChildOf 666 699 Weakness ChildOf 227 888 Category ChildOf 898 On most systems, a combination of setting the SO_REUSEADDR socket option, and a call to bind() allows any process to bind to a port to which a previous process has bound width INADDR_ANY. This allows a user to bind to the specific address of a server bound to INADDR_ANY on an unprivileged port, and steal its udp packets/tcp connection. Architecture and Design Implementation Operation Confidentiality Integrity Read application data Packets from a variety of network services may be stolen or the services spoofed. Policy Restrict server socket address to known local addresses. This code binds a server socket to port 21, allowing the server to listen for traffic on that port. C void bind_socket(void) { int server_sockfd; int server_len; struct sockaddr_in server_address; /*unlink the socket if already bound to avoid an error when bind() is called*/ unlink("server_socket"); server_sockfd = socket(AF_INET, SOCK_STREAM, 0); server_address.sin_family = AF_INET; server_address.sin_port = 21; server_address.sin_addr.s_addr = htonl(INADDR_ANY); server_len = sizeof(struct sockaddr_in); bind(server_sockfd, (struct sockaddr *) &s1, server_len); } This code may result in two servers binding a socket to same port, thus receiving each other's traffic. This could be used by an attacker to steal packets meant for another process, such as a secure FTP server. Anonymous Tool Vendor (under NDA) Eric Dalci Cigital 2008-07-01 updated Time_of_Introduction CWE Content Team MITRE 2008-09-08 updated Common_Consequences, Relationships, Other_Notes, Taxonomy_Mappings CWE Content Team MITRE 2009-05-27 updated Demonstrative_Examples CWE Content Team MITRE 2009-10-29 updated Common_Consequences CWE Content Team MITRE 2011-06-01 updated Common_Consequences, Demonstrative_Examples CWE Content Team MITRE 2011-06-27 updated Common_Consequences CWE Content Team MITRE 2012-05-11 updated Relationships CWE Content Team MITRE 2012-10-30 updated Potential_Mitigations Multiple Binds to Same Port