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…

目录
相关文章
|
自然语言处理 算法 数据挖掘
浅谈Single-Pass算法
Single-Pass算法又称单通道法或单遍法,是流式数据聚类的经典方法。对于依次到达的数据流,该方法按输入顺序每次处理一个数据,依据当前数据与已有类的匹配度大小,将该数据判为已有类或者创建一个新的数据类,实现流式数据的增量和动态聚类,适合对流数据进行挖掘,而且算法的时间效率高;不足之处主要表现在该方法具有输入次序依赖特性,即对于同一聚类对象按不同的次序输入,会出现不同的聚类结果。
179 0
|
网络安全
|
网络安全
|
网络协议 应用服务中间件 网络安全
Fireware attack
http://timeglider.com/timeline/5ca2daa6078caaf4
669 0
|
前端开发 Ruby Python
|
PHP .NET SQL
smarty3: CVE-2014-8350: secure mode bypass
Package: smarty3 Version: All below 3.1.21 Severity: important Smarty secure mode should allow...
852 0
|
Web App开发 前端开发 API
Compass的误解与新发现
最后个人感觉 Compass是 css世界的.NET 很久以前看到 Compass 误以为是css编译器,因为总是在看到如何安装Scss的文章里面看到的 知道最近不小心进入 Compass官网溜达,才发现 The CSS3 module provides cross-browser mixi...
1097 0
|
SQL 安全 MySQL
Beyond SQLi: Obfuscate and Bypass
Beyond SQLi: Obfuscate and Bypass |=---------------------------------------------------------...
1158 0