Skip to content

Connection is dropped with MobaXTerm client #95

Closed

Description

@nikty

Describe the bug
When connecting to ssh-mitm from MobaXTerm client version 21.5, the connection is dropped.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://mobaxterm.mobatek.net/download-home-edition.html
  2. Download and run MobaXterm Portable v21.5
  3. Create new session to ssh-mitm and try to connect
  4. Connection is dropped

Expected behavior
SSH client successfully connects to SSH server

ssh-mitm debug output

ssh-mitm-x86_64.AppImage -d server --listen-port XXX --remote-host XXX
──────────────────────────────────────────────────────────────────────────────────────── SSH-MITM - ssh audits made simple ─────────────────────────────────────────────────────────────────────────────────────────
Version: 1.0.0
Documentation: https://docs.ssh-mitm.at
Issues: https://github.com/ssh-mitm/ssh-mitm/issues
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[03/21/22 15:26:42] INFO     generated temporary RSAKey key with 2048 bit length and fingerprints:                                                                                                   __init__.py:141
                                 MD5:a8:69:09:66:7f:c4:eb:ea:ba:5c:ad:43:69:42:82:3f                                                                                                                 
                                 SHA256:pZGSmr8/zIQF0T9iOjQoT/Pt9lJd2DtpS0iAiqmVy/U                                                                                                                  
                    INFO     listen interfaces 0.0.0.0 and :: on port XXX                                                                                                                          __init__.py:229
[03/21/22 15:26:49] DEBUG    incoming connection from ('::ffff:XXX', XXX, 0, 0) to ('::ffff:XXX', XXX, 0, 0)                                                                   __init__.py:239
                    INFO     ℹ session b7ad0231-d53d-4038-92ce-092043b42a20 created                                                                                                     session.py:68
                    INFO     ℹ connected client version: SSH-2.0-MoTTY_Release_0.76                                                                                              key_negotiation.py:48
                    DEBUG    cookie: 09e3b442f2c200331a53a4920f634839                                                                                                                          key_negotiation.py:51
                    DEBUG    kex_algorithms: ['diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1',    key_negotiation.py:52
                             'diffie-hellman-group1-sha1', 'rsa2048-sha256', 'rsa1024-sha1', 'curve448-sha512', 'curve25519-sha256', '[email protected]', 'ecdh-sha2-nistp256',                          
                             'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'ext-info-c']                                                                                                                              
                    DEBUG    server_host_key_algorithms: ['ssh-ed448', 'ssh-ed25519', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'rsa-sha2-512', 'rsa-sha2-256',     key_negotiation.py:53
                             'ssh-rsa', 'ssh-dss']                                                                                                                                                                  
                    DEBUG    encryption_algorithms_client_to_server: ['aes256-ctr', 'aes256-cbc', '[email protected]', 'aes192-ctr', 'aes192-cbc', 'aes128-ctr', 'aes128-cbc',       key_negotiation.py:54
                             '[email protected]', '3des-ctr', '3des-cbc', 'blowfish-ctr', 'blowfish-cbc', 'arcfour256', 'arcfour128']                                                                   
                    DEBUG    encryption_algorithms_server_to_client: ['aes256-ctr', 'aes256-cbc', '[email protected]', 'aes192-ctr', 'aes192-cbc', 'aes128-ctr', 'aes128-cbc',       key_negotiation.py:55
                             '[email protected]', '3des-ctr', '3des-cbc', 'blowfish-ctr', 'blowfish-cbc', 'arcfour256', 'arcfour128']                                                                   
                    DEBUG    mac_algorithms_client_to_server: ['hmac-sha2-256', 'hmac-sha1', 'hmac-sha1-96', 'hmac-md5', '[email protected]', '[email protected]',         key_negotiation.py:56
                             '[email protected]', '[email protected]']                                                                                                                            
                    DEBUG    mac_algorithms_server_to_client: ['hmac-sha2-256', 'hmac-sha1', 'hmac-sha1-96', 'hmac-md5', '[email protected]', '[email protected]',         key_negotiation.py:57
                             '[email protected]', '[email protected]']                                                                                                                            
                    DEBUG    compression_algorithms_client_to_server: ['zlib', '[email protected]', 'none']                                                                                     key_negotiation.py:58
                    DEBUG    compression_algorithms_server_to_client: ['zlib', '[email protected]', 'none']                                                                                     key_negotiation.py:59
                    DEBUG    languages_client_to_server: ['']                                                                                                                                  key_negotiation.py:60
                    DEBUG    languages_server_to_client: ['']                                                                                                                                  key_negotiation.py:61
                    DEBUG    first_kex_packet_follows: False                                                                                                                                   key_negotiation.py:62

Desktop (please complete the following information):

  • OS: Windows 10
  • MobaXterm Portable v21.5

Activity

  1. manfred-kaiser commented on Mar 21, 2022

    @manfred-kaiser
    Member

    Thanks for the bug report.

    It seems that MobaXterm uses a SSH client implementation, which is not supported by paramiko.

    I will open an issue ticket in paramiko to discuss this problem.

    You can test it with: ssh-mitm --debug --paramiko-log-level debug --disable-workarounds server

    Paramiko exception:

    DEBUG    === End of kex handshake ===                                                                                                                                   transport.py:1873
    ERROR    Exception (server): Expecting packet from (30,), got 34                                                                                                        transport.py:1873
    ERROR    Traceback (most recent call last):                                                                                                                             transport.py:1871
    ERROR      File "/home/manfred/virtualenvs/sshenv/lib/python3.8/site-packages/paramiko/transport.py", line 2122, in run                                                 transport.py:1871
    ERROR        raise SSHException(                                                                                                                                        transport.py:1871
    ERROR    paramiko.ssh_exception.SSHException: Expecting packet from (30,), got 34                                                                                       transport.py:1871
    
  2. manfred-kaiser commented on Mar 24, 2022

    @manfred-kaiser
    Member

    I found the reason, why MobaXterm is unable to connect to SSH-MITM.

    Background:
    With OpenSSH 8.8 sha1 for rsa signatures was deprecated. A lot of ssh libraries has to update to support more secure hash algorithms.

    Paramiko 2.9 has implemented support for the new algorithms, but there are still some problems with older clients and servers, which only support sha1.

    Possible fix
    If you need to intercept clients, which has limited support for the new algorithms you should use Paramiko <2.9.

    I recommend using the Python Package from pypi.org: https://pypi.org/project/ssh-mitm/

    # create virtualenv and activate it
    python3 -m venv ~/sshenv
    source ~/sshenv/bin/activate
    
    # install SSH-MITM as python package
    pip install ssh-mitm 'paramiko<2-9'
    
    # start SSH-MITM
    ssh-mitm server

    This should work with MobaXterm, but you can get problems connecting to OpenSSH 8.8 or later, if you are using the default server configuration.

  3. manfred-kaiser commented on Apr 1, 2022

    @manfred-kaiser
    Member

    This issue is related to paramiko/paramiko#1984 and paramiko/paramiko#2012

    SSH-MITM is compatible with the latest version of paramiko and 'paramiko<2-9'.

    If the client is not compatible (like MobaXterm) with the latest version of paramiko, paramiko<2-9 should be used as decribed in #95 (comment)

  4. added
    bug
    on Apr 1, 2022
  5. manfred-kaiser commented on Jul 12, 2022

    @manfred-kaiser
    Member

    An analysis of the connection has shown that MobaXterm uses the SSH components of "SecureBlackbox" for the integrated SFTP client.

    This can be seen from the version string sent from the client to the server: SSH-2.0-SecureBlackbox.9.

    For shell connections (SSH) a PuTTY fork named MoTTY is apparently used. SSH-2.0-MoTTY_Release_0.77

    Only the SFTP connection via the SecureBlackbox SSH component is affected by the described problems.

  6. manfred-kaiser commented on Jul 12, 2022

    @manfred-kaiser
    Member

    I have created a pull request for paramiko, which should fix the described bug: paramiko/paramiko#2083

    @nikty Thanks for the bug report 👍

  7. added a commit that references this issue on Jul 13, 2022
    eca1cbb
  8. manfred-kaiser commented on Jul 13, 2022

    @manfred-kaiser
    Member

    @nikty the latest development branch has a workarround, which adds compatibility for MobaXterm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions