Both meterpreter shell and classic shell are supported. The exploit will copy a payload to a writable directory in the container and then escape the container and either search for the payload on the file system or copy it directly from the container and then execute it on the host.
# Creating A Testing Environment
- Install Docker
- Create a privileged container (forwarding port 4444 in this example in order to use a bind shell from the host)
```bash
docker run -d -it --name test-vuln-container -p 4444:4444 --privileged ubuntu
```
- Obtain a shell on the container with metasploit. One possible option is:
Set this option to choose which type of root session you want to create.
## ForceExploit
Force exploit even if the current session does not appear to be in a docker container, or the container does not appear vulnerable.
## ForcePayloadSearch
Force the exploit to search for the payload in the file system rather than copying out of the docker container. This avoids the need for a writable directory on the host system. Typically, the filesystem of the container will be located in the `/var/lib/docker/overlay2/` directory.
## WritableContainerDir
A directory where we can write files inside the container (default is /tmp). This is needed to drop the payload into the container.
A directory where we can write files on the host (default is /tmp). This is needed to copy the payload from the container onto the host. Alternatively see ForcePayloadSearch
# Scenarios
## Container Escape starting with a meterpreter shell