ssh-mitm: intercepting proxy server for security audits
ssh-mitm – intercept ssh traffic
ssh-mitm is an intercepting (mitm) proxy server for security audits.
- 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 a gateway.
- Since release 0.2.0, SSH Proxy Server has full support for tty (shell), scp, and sftp!
Feature
- session recording
- session hijacking
- modify files with scp and sftp
- authentication passthrough (password and public key)
SSH MITM Attacks
SSH uses trust on first use. This means, that you have to accept the fingerprint if it is not known.
If a server fingerprint is known, ssh warns the user, that the host identification has changed.
If the victim accepts the (new) fingerprint, then the session can be intercepted.
Use-Case: Honey Pot
When ssh proxy server is used as a honey pot, attackers will accept the fingerprint, because he wants to attack this machine. An attacker also does not know if the fingerprint is correct and if the key has changed, perhaps it the server was reinstalled and a new key pair was generated.
User-Case: Security Audit
Intercepting ssh during security audits is useful to understand, how an application works.
For example, if you have an application, which connects to your local router via ssh, to configure the device, you can intercept those connections, if the application does not know the fingerprint and accept it on first use.
If the application knows the fingerprint, then the same host key is used on every device. In this case, you have a good chance to extract the host key from a firmware updated and use it to trick the application.
Install
pip install ssh-mitm
Use
Password authentication
Start the server:
ssh-mitm --remote-host 127.0.0.1
Connect to server:
ssh -p 10022 user@proxyserver
Public key authentication
When public-key authentication is used, the agent is forwarded to the remote server.
Start the server:
ssh-mitm --forward-agent --remote-host 127.0.0.1
Connect to server:
ssh -A -p 10022 user@proxyserver
Authors
- Manfred Kaiser
- Simon Böhm