COMMON WEAKNESS ENUMERATIONDraft

CWE-605

Multiple Binds to the Same Port

When multiple sockets are allowed to bind to the same port, other services on that port may be stolen or spoofed.

Abstraction

Variant

Structure

Simple

Likelihood of Exploit

Medium

Understand the problem

What is the problem?

When multiple sockets are allowed to bind to the same port, other services on that port may be stolen or spoofed.

Extended description

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 with 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.

Root cause

How and when does the problem arise?

Lifecycle phase

Implementation

Lifecycle phase

Operation

Risk

What does successful exploitation lead to?

Read Application Data

Affected security scopes: Confidentiality, Integrity

Packets from a variety of network services may be stolen or the services spoofed.

Defence

How is it prevented and fixed?

Policy

Policy aşaması savunması

Detail
Restrict server socket address to known local addresses.

Verification

How is it detected?

Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)