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)。之前也遇到过,按照网上的操作能解决,但是一知半解,今天趁此把该问题消化掉。
5057 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.
1271 0
|
网络安全
Responding to a Brute Force SSH Attack
http://www.securityfocus.com/infocus/1903/
1085 0
|
Linux 网络安全 Docker
盘古栈云,创建带ssh服务的linux容器
创建带ssh服务的linux容器
662 146
|
安全 Linux Shell
Linux中SSH命令介绍
Linux中SSH命令介绍
1089 2
|
监控 Linux 网络安全
FinalShell SSH工具下载,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux
FinalShell是一款国人开发的多平台SSH客户端工具,支持Windows、Mac OS X和Linux系统。它提供一体化服务器管理功能,支持shell和sftp同屏显示,命令自动提示,操作便捷。软件还具备加速功能,提升访问服务器速度,适合普通用户和专业人士使用。
4817 0
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
762 10
|
监控 Ubuntu Linux
使用VSCode通过SSH远程登录阿里云Linux服务器异常崩溃
通过 VSCode 的 Remote - SSH 插件远程连接阿里云 Ubuntu 22 服务器时,会因高 CPU 使用率导致连接断开。经排查发现,VSCode 连接根目录 ".." 时会频繁调用"rg"(ripgrep)进行文件搜索,导致 CPU 负载过高。解决方法是将连接目录改为"root"(或其他具体的路径),避免不必要的文件检索,从而恢复正常连接。
|
监控 安全 Ubuntu
在Linux中,如何进行SSH服务配置?
在Linux中,如何进行SSH服务配置?
|
Shell Linux 网络安全
Linux怎样在使用ssh 链接时就指定gcc 的版本
Linux怎样在使用ssh 链接时就指定gcc 的版本
365 7