How name-lists are separated in SSH2 algorithm negotiation packet payload?

Ernestas Gruodis

I found in RFC4253 that:

7.1. Algorithm Negotiation

Key exchange begins by each side sending the following packet:

  byte         SSH_MSG_KEXINIT
  byte[16]     cookie (random bytes)
  name-list    kex_algorithms
  name-list    server_host_key_algorithms
  name-list    encryption_algorithms_client_to_server
  name-list    encryption_algorithms_server_to_client
  name-list    mac_algorithms_client_to_server
  name-list    mac_algorithms_server_to_client
  name-list    compression_algorithms_client_to_server
  name-list    compression_algorithms_server_to_client
  name-list    languages_client_to_server
  name-list    languages_server_to_client
  boolean      first_kex_packet_follows
  uint32       0 (reserved for future extension)

Each of the algorithm name-lists MUST be a comma-separated list of algorithm names (see Algorithm Naming in [SSH-ARCH] and additional
information in [SSH-NUMBERS]). Each supported (allowed) algorithm
MUST be listed in order of preference, from most to least.

But I can not find in RFC nothing about how to separate name-lists in payload..

EDIT: All solved with DataInputStream, using it's convenient methods readByte(byte[] b, int off, int len), readInt() and readBoolean().

Sean Bright

As the RFC states, there is more information in SSH-ARCH which is RFC 4251. Here is a partial excerpt of how name-list is defined:

A string containing a comma-separated list of names. A name-list is represented as a uint32 containing its length (number of bytes that follow) followed by a comma-separated list of zero or more names.

So after you have read the first 17 bytes of the key exchange packet, you will want to read 4 bytes which will tell you how many bytes (it's ASCII encoded so 1 byte per character) you will need to read to consume the rest of that name-list. Then you repeat this process for each subsequent list.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How name-lists are separated in SSH2 algorithm negotiation packet payload?

From Dev

ssh algorithm negotiation failed

From Dev

Netbeans SSH: Cannot connect to server ... Algorithm negotiation fail - how to fix?

From Dev

Algorithm negotiation fail SSH in Jenkins

From Dev

SQLDeveloper SSH Connection Algorithm negotiation fail

From Dev

PhpStorm: Algorithm negotiation fail

From Dev

Algorithm negotiation fail in Jenkins

From Dev

JSch Algorithm negotiation fail

From Dev

HTTP Accept negotiation algorithm

From Dev

Get ICMP packet payload

From Dev

Capture the data and payload in a packet

From Dev

How to get packet.tcp.payload and packet.http.data as string?

From Dev

SharpSSH jsch Algorithm negotiation fail

From Dev

error:Algorithm negotiation fail with SharpSSH

From Dev

How to split a list separated by ";" into sub lists in ColdFusion

From Dev

How to reduce SSH2 "loading" time

From Dev

UDP payload length and packet transmission

From Dev

Send TCP SYN packet with payload

From Dev

Decompressing a gzipped payload of a packet with Python

From Dev

Sending PublicKey within packet payload

From Dev

Is UDP packet payload size fixed?

From Dev

Extracting RTP payload from packet

From Dev

Jnetpcap Payload modify in UDP packet

From Dev

JSch algorithm negotiation fail with OSX El Capitan

From Dev

Algorithm Negotiation failed when trying to connect to server

From Dev

How to get name of comma separated id in mysql?

From Dev

How to make the controller's name hyphen "-" separated?

From Dev

How to name list of lists in Python?

From Dev

how to change the name of lists to unique