Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Jeffs-GitHub opened this issue Jan 9, 2025 · 3 comments

Comments

@Jeffs-GitHub
Copy link

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?

@Rob-Hague
Copy link
Collaborator

Hi, do you see the same problem on the latest version 2024.2.0? Or at least 2023.0.1. Quite a lot has changed in the library since 2020.0.1

If the problem still occurs, the next step would probably be to capture a packet trace with wireshark or similar. That might inform a bit more about the exact contents and flow of the initial exchange packets

@chris-ewd
Copy link

Hello Rob,

same issue here for me since an external SFTP was updated recently. My dll was rather old (I think 2016'ish).

I tried to upgrade to 2024.2.0 but I get the same error. I tried 2025.0.0 in a simple console app for testing purposes and it worked there, also works fine using FileZilla etc.

I'm not able at this point to upgrade the entire project from net6 to net8 due to incompabilities of other DLLs.

Has anything significant changed from 2024.2.0 to 2025.0.0 that I can backport?

@Rob-Hague
Copy link
Collaborator

2025.0.0 is compatible with net6 despite not targeting it specifically - I don't think you should have any problems with using it

I'm not sure what would have changed to fix a connection between 2024.2.0 and 2025.0.0, unless perhaps the updated server is using only the very latest algorithms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy