sshnet / sshnet/SSH.NET

Renci.SSH Error in VB.Net, Getting Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.

Open
#1,569 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

Attempts to connect to a server using Renci.SSH result in an exception.

The device can be accessed usingTeraterm.

.Net gives this exception:
Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.CreateAndConnectSession()
at Renci.SshNet.BaseClient.Connect()

This is the output from Debug:
SshNet.Logging Verbose: 1 : Initiating connection to '<my_ip_addr>:22'.
SshNet.Logging Verbose: 1 : Server version '2.0' on 'OpenSSH_9.2p1 Debian-2+deb12u3'.
SshNet.Logging Verbose: 5 : [] Received message 'KeyExchangeInitMessage' from server: 'SSH_MSG_KEXINIT'.
SshNet.Logging Verbose: 5 : [] Sending message 'KeyExchangeInitMessage' to server: 'SSH_MSG_KEXINIT'.
SshNet.Logging Verbose: 5 : [] Sending message 'KeyExchangeDhGroupExchangeRequest' to server: 'SSH_MSG_KEX_DH_GEX_REQUEST'.
SshNet.Logging Verbose: 5 : [] Raised exception: Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
SshNet.Logging Verbose: 1 : [] Disposing session.
SshNet.Logging Verbose: 1 : [] Disconnecting session.
SshNet.Logging Verbose: 1 : [] Shutting down socket.
SshNet.Logging Verbose: 1 : [] Disposing socket.
SshNet.Logging Verbose: 1 : [] Disposed socket.
SshNet.Logging Verbose: 5 : [] Disconnecting after exception: Renci.SshNet.Common.SshConnectionException: An established connection was aborted by the server.
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.CreateAndConnectSession()
Exception thrown: 'Renci.SshNet.Common.SshConnectionException' in Renci.SshNet.dll

Here is some version info:
Renci.SshNet, Version=2020.0.1.0
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.10.1

It looks like my server did not like the key exchange request.

In Teraterm, it says "The server's host key fingerprint is: Fingerprint hash algorithm SHA256" then shows the hash.

Does anyone have any ideas that I could try? Is there any other information I could provide in helping find a solution?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the connection using SSH.NET 2020.0.1 against OpenSSH_9.2p1 on Debian, then review the supplied debug trace around KeyExchangeDhGroupExchangeRequest. Compare the behavior with the successful Tera Term connection; done means identifying a reproducible cause and a supported fix or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.