Package eu.tneitzel.rmg.networking
Class DummySocketFactory
- java.lang.Object
-
- java.rmi.server.RMISocketFactory
-
- eu.tneitzel.rmg.networking.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
-
-
Constructor Summary
Constructors Constructor Description DummySocketFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerSocketcreateServerSocket(int port)SocketcreateSocket(String host, int port)-
Methods inherited from class java.rmi.server.RMISocketFactory
getDefaultSocketFactory, getFailureHandler, getSocketFactory, setFailureHandler, setSocketFactory
-
-
-
-
Method Detail
-
createServerSocket
public ServerSocket createServerSocket(int port) throws IOException
- Specified by:
createServerSocketin interfaceRMIServerSocketFactory- Specified by:
createServerSocketin classRMISocketFactory- Throws:
IOException
-
createSocket
public Socket createSocket(String host, int port) throws IOException
- Specified by:
createSocketin interfaceRMIClientSocketFactory- Specified by:
createSocketin classRMISocketFactory- Throws:
IOException
-
-