The fact that comm could change at any time (i.e. as the route table changes) made it very difficult to reason about the state of the parameters object. If the route table is changed after a session is established, then the params object associated with the session object could then change its comm value. It is helpful for a Metasploit session object to use the params object to initialize sockets; but if they could change between creation of the session and creation of the socket, this introduces a race condition whereby a session is appropriately set up, but a socket it creates (e.g. via TCP forwarding) believes it's being passed through a different session, or none at all.
This commit also adds the comm attribute to sockets, so that sockets can deduce which session they're listening on.
This change supports PR 15706 in Metasploit.
The fact that
comm
could change at any time (i.e. as the route table changes) made it very difficult to reason about the state of the parameters object. If the route table is changed after a session is established, then the params object associated with the session object could then change itscomm
value. It is helpful for a Metasploit session object to use the params object to initialize sockets; but if they could change between creation of the session and creation of the socket, this introduces a race condition whereby a session is appropriately set up, but a socket it creates (e.g. via TCP forwarding) believes it's being passed through a different session, or none at all.This commit also adds the
comm
attribute to sockets, so that sockets can deduce which session they're listening on.