How to create a remote shell from Kali Linux to Windows 10 using SSH

in Account Booster 👍4 years ago

Connecting your linux machine (installed in Virtualbox) and your actual SO (Windows 10) may be very useful. I will explain here which steps you have to follow to create a SSH connection between them. Then, I will show how you can create a reverse (remote) shell between them. Let´s start, shall we?
In this case, to install SSH on Windows 10, I am going to use the Optional feautres (there are several programs for that purpose such as "FreeSSHD").
Using Windows Explorer, you have to search "Apps and features".

image.png

Open optional features

image.png

Search for "ssh" in "Add a feature" and install both Client and Server if they are not already installed.

image.png

Once it is installed, you will need to start the service. I used PowerShell to do this. Launch it as Administrator and enter the following commands

  • Get-Service sshd. You will see that it is stopped as this commands gets the sshd status.
  • Start-Service sshd. Now it is started, if you want to stop: Stop-Service sshd.

image.png

Now that we have starte our sshd service in windows, let´s go to the Virtual machine!

First of all, the Network configuration must be Attached to NAT:

image.png

Start the virtual machine and open a Terminal.
If not installed, you must install openssh-server with the next command: sudo apt-get install openssh-server
To stat the sshd service, just type: sudo service sshd start. You will be asked to enter the password:

image.png

At this moment, both SSH services are running (on Windows and Linux). The syntax to connect is (always): ssh username@ip
For example, from Linux to Windows first you have to check your IP in Windows with the ipconfig command:

image.png

As you can see, my IP in Windows is: 192.168.0.24. The username is "jorge".
Now type in the Kali´s shell: ssh [email protected]

image.png

Then it will ask if you want to continue connecting. Type "yes" and press Enter. Now, something important: you must have set a password in your windows. If not, it won´t be able to connect for security reasons. Type your Windows password, and ¡voilà! now you have a reverse shell in your Kali Linux machine!

Now you will see what happens if I type "ipconfig" in the Kali Linux terminal:

image.png

This is the way you can connect from Linux to Windows using SSH service and create which is called a reverse shell. This is one of the techniques used by hackers to get into a System and then escalate privileges.
I hope you find it useful.