1
I'm understanding that the ephemeral port in a socket pair is a random port number that the client chooses in order for the server to respond back to. In a case where communication happens on a local network and the client has no firewall, is it possible for there to be another process on the local network that uses the ephemeral port as an open attack point while a connection is open with a server?
In the case where the client and server are not on the same subnet, is it possible for the sending of data back to the ephemeral port to be made over a different route than it is received on the server? Are there rules in the internet protocol that specifically require the same route to be used for communication in both directions?
Will the answers to my questions change if TCP or UDP are used?
Agreed. In my own (brief) testing of source port allocation, a bind() call creates a socket using incremental source ports (increasing in steps of two), whereas connect() randomly picks an available port from the ephemeral range. – Mark Riddell – 2016-08-18T18:15:52.433
So if a reply packet can take different routes, I guess it has to be returned from the same IP address though? Just wondering if I could have a server that has two ethernet interfaces, one connected to a slow, but more expensive static IP and the second connected to a fast, cheaper but sometimes dynamic IP address, allowing the client request to come in on the static IP address, but then reply back on the dynamic IP address? – user1748155 – 2016-08-18T20:08:32.030