0 votes
by (380 points)

Cisco 7200, Cisco IOS 12.4(24)T

Message: Received invalid packet.

   at Rebex.Net.UEB.AB(Byte[] A)
   at Rebex.Net.SshSession.VY(Byte[]& A)
   at Rebex.Net.SshSession.YY(NGB A, Object[] B)
   at Rebex.Net.SshChannel.YB(Boolean A, NGB B, Object[] C)
   at Rebex.Net.SshChannel.Close()
   at Rebex.Net.TRB.Close()
   at Rebex.TerminalEmulation.GUB.DB()
   at Rebex.TerminalEmulation.DVB.Z()
   at Rebex.TerminalEmulation.Scripting.Close()
by (380 points)
I have sent the log file to support email.
by (147k points)
Thanks for reporting this and for the log!
However, the error occurred deep in the core of the SSH protocol – this is very rare and although the log makes it possible to tell where in which part of the packet decoding the error occurred, it doesn’t show any clue about what might have possibly gone wrong.
I sent you a link to a hotfix with slightly enhanced logging for this particular error, please give it a try and send back a new (and hopefully more informative) log. Sorry for inconvenience!
by (380 points)
I have sent the enhanced log file to support email.

1 Answer

0 votes
by (147k points)

After further analysis of the log files, it looks like this is caused by a server bug - closing the channel seems to confuse the server to sending wrong data which can’t be correctly decrypted and parsed by the client.

The error doesn't occur when the whole session is closed without closing its channels first (which is what many third-party clients such as PuTTY do), and it also doesn't occur when the client ends the shell channel by sending the "exit" command (in that case, it’s actually the server, not the client, that closes the channel).

This means that sending the "exit" command and waiting for the server to close the channel works around the issue:

      var scripting = ssh.StartScripting();
      scripting.DetectPrompt();

      scripting.SendCommand("echo Hello");
      string response = scripting.ReadUntilPrompt();

      scripting.SendCommand("exit");
      scripting.ReadUntil(ScriptEvent.Closed);

      scripting.Close();

Closing the whole SSH session might do the trick as well:

      var scripting = ssh.StartScripting();
      scripting.DetectPrompt();

      scripting.SendCommand("echo Hello");
      string response = scripting.ReadUntilPrompt();

      scripting.SendCommand("exit");
      scripting.ReadUntil(ScriptEvent.Closed);

      ssh.Disconnect();
...