This question assumes that the client and server are using the
SslRMIClientSocketFactory and SslRMIServerSocketFactory classes
introduced in Java 5.
Suppose a client application wants to connect to a server through
SSL/RMI and authenticate the server's identity. Presumably, the server
will have exported a remote object, passing instances of
SslRMIClientSocketFactory and SslRMIServerSocketFactory to
UnicastRemoteObject.exportObject(). Meanwhile, the client is set up
with a "truststore" file to only allow SSL connections to the desired
server.
Now, what prevents a man-in-the-middle attack? What if a malicious
server intercepts the initial connection request from the client and
has exported its own remote object, but with a plain (non-SSL)
RMIClientSocketFactory? The client normally uses its truststore to
specify what servers it can connect to through SSL, but the client did
not specify that connections must be through SSL.
Can the client verify that the RMIClientSocketFactory provided is, in
fact, an SslRMIClientSocketFactory? |