SSH error “buffer_get_string_ret: bad string length 13105607” and “buffer_get_string: buffer error”

I had no problem connecting via SSH from all my remote locations to my debian server for a long time, but then all of the sudden I started getting the error shown below. By ‘remote’ I mean there was a firewall and the internet in between (and obviously I was using a port forward) the client and server. The server is the ‘debian’ ssh server.

I was getting the following error connecting from any remote location to my debian server:

debian:~/sshtest# ssh -p 50005
buffer_get_string_ret: bad string length 13105607
buffer_get_string: buffer error

Also its important to note every time I tried to connect the number 13105607 would change

NOTE: the above connection was actually done from the ‘debian’ server connecting back in on itself by talking to its firewalls wan port (which port forwards to localhost port 22 on the same debian server). Either way connecting from any remote client to this debian server produced the above error.

Connecting inside the network (within the firewall) produced no error. So I could connect with any SSH service (winscp, putty etc..)

Here is how a good connection looked like (just the typical common connection):

debian:~/sshtest# ssh localhost
The authenticity of host 'localhost (' can't be established.
ECDSA key fingerprint is f0:e5:56:71:e3:d9:23:c3:bf:6f:02:07:ad:db:04:d4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
root@localhost's password:


debian:~/sshtest# ssh localhost
root@localhost's password:

Researching online: Online resources mention that the error type is due to the key, but I have recreate the key and its still the same type of error.

I had to result down to doing packet captures. I bet there is packet errors. I saw some packets that had incorrect checksums, so I figured the firewall was the culprit.

I had a router (not going to mention the brand) that seemed to be causing this (maybe its because I was doing a translated port forward, or maybe just the fact that it was a portforward). But the solution was simple. I just logged in to the router and initiated a firmware upgrade, after it reboot and was loaded with the latest firmware. All of the sudden the ssh connection worked. No longer was I producing the error.

debian:~/sshtest# ssh -p 50005 password:



Leave a Reply

Your email address will not be published. Required fields are marked *