Class DummySocketFactory

  • All Implemented Interfaces:
    Serializable, RMIClientSocketFactory, RMIServerSocketFactory

    public class DummySocketFactory
    extends RMISocketFactory
    implements Serializable
    During the creation of the An Trinh registry whitelist bypass gadget, the creation of a UnicastRemoteObject is required. There are several different ways to achieve this. One of them is to access the 'official' constructor via reflection. This approach is used by rmg, but it has the downside that RMI tries to export the object within the constructor directly. Therefore, when blindly using the constructor, a port will open on your machine. To avoid this, rmg uses a dummy socket factory with the constructed UnicastRemoteObject. This dummy socket factory returns a dummy ServerSocket with an overwritten accept method. Calls to accept just cause a sleep. In this time, rmg has already unexported the object, which closes the socket.
    Author:
    Tobias Neitzel (@qtc_de)
    See Also:
    Serialized Form