SSH2 “MITM” like attack with JMITM2

简介: First: the following attack is not a real (at least not a perfect) man-in-the-middle attack, s...

First: the following attack is not a real (at least not a perfect) man-in-the-middle attack, since the target will get a warning about the altered SSH server footprint and the attacker needs to “hijack” the communication between the target and the SSH server (ARP cache poisoning for example…), but I think the tool deserves a note (all the credits for the software goes to David Gümbel).

I remember, the first time I downloaded JMITM2 from http://www.david-guembel.de/index.php?id=6I was sitting in a web cafe near to the university with a friend trying to “attack” each others SSH2 connection. Tonight I am alone, so I started two Damn Small Linux (DSL) in Virtualbox. One will be the SSH server (192.168.56.101), other will be the attacked client (192.168.56.102) and the host will be the attacker (192.168.56.1).

After starting the SSH server on 192.168.56.101 with the commands “sshstart” and “/etc/init.d/ssh start” and connecting to the service from the client machine (192.168.56.102) to get the RSA fingerprint it is time to prepare the attacker machine.

I will start with JMITM2 since it needs some configuring and arpspoof is pretty simple to use…

First we need to edit JMITM2′s bin/conf/server.xml file and change the “ListenAddress” to our IP (192.168.56.1 in this case) and “Port” to the standard SSH port (22).

JMITM2 server.xml configuration

Now let’s edit the bin/runm.sh script and set the SSH server’s IP address (192.168.56.101) as the first parameter:

JMITM2 runm.sh configuration

JMITM2 is set up, for arpspoof we just need a few iptables rules:

jmitm2 - arpspoof

We need to spoof “two-ways” so two arpspoof will be running (the attacked machine must think we are the SSH server and normally the SSH server should think we are the attacked machine), so we should run “arpspoof -i vboxnet0 -t 192.168.56.101 192.168.56.102″ as well.

After these steps when the target tries to connect to the SSH server he will connect to us (hopefully provide us a password :) ) and we will build a new connection to the SSH server in his name (just like a proxy). Of course the situation is not that simple. When the attacked machine connects to us JMITM2 will start connecting to the SSH server and ask us if we accept the provided fingerprint (this is necessary only first time) – of course we accept it. JMITM2 sends a login prompt to the attacked machine, but the SSH client will warn the user, that the fingerprint sent by us is not the same as the “original” SSH server’s:

jmitm2 - rsa fingerprint changed

If the user “wants to continue connecting” (which he really should not!) we will get his/her credentials:

JMITM2 - got username and password for SSH2

(by the way as you can see JMITM2 generates a lot of output, “grep” is recommended ;) )

The session for the attacked user of course will work correctly, we will “proxy” every command and result.

JMITM2 - target connected

Some things to notice:

  • the attack absolutely depends on the attacked user, if he doesn’t accept the changed RSA key fingerprint we are lost
  • maybe I was not careful enough, but JMITM2 builds the connection to the SSH server in our name (from our IP), so the attacker IP will be logged on the server…  I will check soon if this is how it is meant to work.
  • ARP spoofing is bad

Maybe later I will play with the plugin features of JMITM2, I think there will be some more fun to discover.

// I welcome every comment or observation…

目录
相关文章
|
存储 安全 算法
一文彻底搞懂什么是SSH中间人攻击(Man-in-the-middle attack)
服务器重新安装之后,ssh无法连接,提示中间人攻击(man-in-the-middle-attack)。之前也遇到过,按照网上的操作能解决,但是一知半解,今天趁此把该问题消化掉。
3047 0
|
网络安全
SSH Man-in-the-Middle Attack and Public-Key Authentication Method
http://www.signedness.org/tools/ SSH is a protocol for secure remote login and other secure network services over insecure networks.
1025 0
|
网络安全
Responding to a Brute Force SSH Attack
http://www.securityfocus.com/infocus/1903/
777 0
|
7月前
|
安全 Linux Shell
Linux中SSH命令介绍
Linux中SSH命令介绍
179 2
|
2月前
|
监控 Ubuntu Linux
使用VSCode通过SSH远程登录阿里云Linux服务器异常崩溃
通过 VSCode 的 Remote - SSH 插件远程连接阿里云 Ubuntu 22 服务器时,会因高 CPU 使用率导致连接断开。经排查发现,VSCode 连接根目录 ".." 时会频繁调用"rg"(ripgrep)进行文件搜索,导致 CPU 负载过高。解决方法是将连接目录改为"root"(或其他具体的路径),避免不必要的文件检索,从而恢复正常连接。
|
5月前
|
监控 安全 Ubuntu
在Linux中,如何进行SSH服务配置?
在Linux中,如何进行SSH服务配置?
|
5月前
|
安全 Linux 网络安全
在Linux中,如何配置SSH以确保远程连接的安全?
在Linux中,如何配置SSH以确保远程连接的安全?
|
5月前
|
安全 Linux Shell
SSH 命令完整实用指南 | Linux SSH 服务
【8月更文挑战第20天】
593 0
|
5月前
|
安全 Linux Shell
如何在 Linux 服务器上配置基于 SSH 密钥的身份验证
如何在 Linux 服务器上配置基于 SSH 密钥的身份验证
357 0
|
5月前
|
Linux 网络安全 数据安全/隐私保护
Linux——配置SSH免密登录
Linux——配置SSH免密登录
120 0

热门文章

最新文章

下一篇
开通oss服务