Post 09 - PIVOT!

09 Dec 2022

Task 14, Day 09, Pivoting Dock the halls

Common way to tell if a compromised application is running in a docker container is checking if root dir has /.dockerenv.

Metasploit

Common console commands for viewing and manipulating sessions:

Meterpreter

Meterpreter is an advanced payload that provides interactive access to a compromised system. Commands include:

Using Metasploit and Meterpreter

Metasploit Framework - msfconsole to start Metaploit.

Can 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]

Socks Proxy

intermediate 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,

The Task

Get info to find potential vulns, and prove level of security.