Skip to content

Encrypt-then-MAC feature should be tested in remote end's configuration when receiving data #1331

@malyzelenyhnus

Description

@malyzelenyhnus

Describe the bug
Both _libssh2_transport_read() and _libssh2_transport_send() are testing presence of encrypt-then-mac feature by the same code

etm = encrypted && session->local.mac ? session->local.mac->etm : 0;

When reading session->remote should be used instead.

To Reproduce

Configure only one from LIBSSH2_METHOD_MAC_CS and LIBSSH2_METHOD_MAC_SC to use etm feature:

 libssh2_session_method_pref(session, LIBSSH2_METHOD_MAC_CS, "hmac-sha2-256-etm@openssh.com");
 libssh2_session_method_pref(session, LIBSSH2_METHOD_MAC_SC, "hmac-sha2-256");

Received data are then misinterpreted and usually it fails with error

[libssh2] 0.684036 Failure Event: -41 - Failed to get response to ssh-userauth request

because obtained payload length is random value > LIBSSH2_PACKET_MAXPAYLOAD.

Version (please complete the following information):

  • OS and version SLES12-SP5
  • libssh2 version: current git master (b273839)
  • crypto backend and version: openssl-1_0_0-1.0.2p-3.90.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions