Skip to content
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

MAC Cipher umac-128-etm@openssh.com does not correctly work #603

Open
iguyking opened this issue Jul 13, 2020 · 13 comments
Open

MAC Cipher umac-128-etm@openssh.com does not correctly work #603

iguyking opened this issue Jul 13, 2020 · 13 comments

Comments

@iguyking
Copy link

When using the libressl-portable version with "OpenSSH for Windows", the MAC cipher umac-128-etm@openssh.com does not work correctly.

Details can be found with issue #1359 in the Powershell/Wind32-Openssh project.

PowerShell/Win32-OpenSSH#1359

@kinichiro
Copy link
Contributor

Hi,

I have 3 different version of OpenSSH installed servers.
And those OpenSSHs are linked with different version of OpenSSL, respectively.
I could successfully connect to these 3 servers from my Windows10
with -m umac-128-etm@openssh.com option.

My client and servers environment here.
"SSH and LibreSSL version" shows the results of ssh -V.

- Client
  OS : Windows10 Home 64bit
  SSH and LibreSSL version : OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

- Server1
  OS : Fedora 31 (x86_64)
  SSH and LibreSSL version : OpenSSH_8.1p1, OpenSSL 1.1.1g FIPS  21 Apr 2020

- Server2
  OS : Ubuntu18
  SSH and LibreSSL version : OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017

- Server3
  OS : Ubuntu14
  SSH and LibreSSL version : OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13, OpenSSL 1.0.1f 6 Jan 2014

From Windows10 cmd.exe, I typed command like below and was able to connect to my servers successfully.

C:\work>ssh -m umac-128-etm@openssh.com myserver

I have no changes to my /etc/ssh/sshd_config.
Are there any configurations to reproduce this issue ?

@jansohn
Copy link

jansohn commented Jul 14, 2020

@kinichiro I think this can be only reproduced when using cipher aes128-ctr.

sftp.exe -o "ciphers=aes128-ctr" -o "macs=umac-128-etm@openssh.com" user@hostname

@kinichiro
Copy link
Contributor

@jansohn Thanks.
I saw ssh -m umac-128-etm@openssh.com -c aes128-ctr user@hostname on Windows10 failed.

C:\work>ssh -m umac-128-etm@openssh.com -c aes128-ctr user@hostname
Corrupted MAC on input.
ssh_dispatch_run_fatal: Connection to xx.xx.xx.xx port 22: message authentication code incorrect

@kinichiro
Copy link
Contributor

On Ubuntu18 server, that runs OpenSSH_7.6p1 with OpenSSL 1.0.2n,
I had built OpenSSH 8.3p1 with LibreSSL 3.1.3 like below.

LibreSSL 3.1.3 build
$ ./configure --prefix=/mypath
$ make check
$ make install

OpenSSH 8.3p1 build
$ export LD_LIBRARY_PATH=/mypath/lib
$ ./configure --prefix=/mypath --with-ssl-dir=/mypath
$ make install

And this ssh client using umac-128-etm@openssh.com and aes128-ctr can successfully connect to localhost.

$ ./ssh -V
OpenSSH_8.3p1, LibreSSL 3.1.3
$
$ ./ssh -m umac-128-etm@openssh.com -c aes128-ctr localhost
localhost's password:
...

I believe this issue is specific to Windows build.

@kinichiro
Copy link
Contributor

@iguyking , @jansohn ,
Original issue seems to be closed now.
Can you close this, too ?
And I think this is "OpenSSH for Windows" specific issue, since I had tested OpenSSH with LibreSSL on Linux platform as above comment.
Am I misunderstanding ?

@jansohn
Copy link

jansohn commented Jul 19, 2020

@kinichiro no, I don't think this issue should be closed as it seems to be a specific problem with LibreSSL. The problematic combination works for example with the Git for Windows ssh binary which uses OpenSSL instead of LibreSSL.

"C:\Program Files\Git\usr\bin\ssh.exe" -v -m umac-128-etm@openssh.com -c aes128-ctr user@hostname
OpenSSH_8.3p1, OpenSSL 1.1.1g  21 Apr 2020
[...]
Last login: Sun Jul 19 18:29:51 2020 from 192.1.1.55
[user@hostname ~]$

@kinichiro
Copy link
Contributor

@jansohn Can you tell or provide link about the procedure to build that Windows ssh ?
As I mentioned above, I believe this issue is specific to Windows build.
To see more about this issue, building ssh with libressl on Windows is needed.

@jansohn
Copy link

jansohn commented Aug 5, 2020

@kinichiro I'm not very familiar with the build process but afaik @bagajjal is.

@tgauth
Copy link

tgauth commented Jan 8, 2024

I can provide support for building ssh with libressl on Windows to help debug this.

The latest release of OpenSSH for Windows with LibreSSL is available at https://github.com/powershell/win32-OpenSSH/releases/
and instructions for building the repo can be found at https://github.com/PowerShell/Win32-OpenSSH/wiki/Building-OpenSSH-for-Windows-(using-LibreSSL-crypto)

Also if it's been too long since this issue was opened, and we should open another one - let me know!

@mtinberg
Copy link

I can confirm that this issue is still present

PS C:\Users\mtinberg> ssh -V
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
PS C:\Users\mtinberg> ssh -m umac-128-etm@openssh.com host.example.com
Corrupted MAC on input.
ssh_dispatch_run_fatal: Connection to 192.0.2.101 port 22: message authentication code incorrect
PS C:\Users\mtinberg> ssh -m hmac-sha2-512-etm@openssh.com host.example.com
[mtinberg@host ~]$

@botovq
Copy link
Contributor

botovq commented Jan 11, 2024

It would be interesting to know if this issue goes away if LibreSSL is compiled with -DOPENSSL_SMALL_FOOTPRINT.
One possible explanation for the breakage is that this is compiled with a modern compiler that may break code that relies on undefined behavior to gain speed.

I do not currently have access to a Windows platform, nor do I have time to do a lot of debugging for this issue myself, but if someone could confirm this, I think I have an idea how to fix this properly.

@tgauth
Copy link

tgauth commented Feb 5, 2024

@mtinberg, can you provide some more details about your repro? What's the architecture of the client machine? Is the issue present connecting to any ssh server? I've tested from an ssh client on an AMD64 Windows machine to both a Windows and Ubuntu ssh server, but cannot repro.

I can also compile LibreSSL with -DOPENSSL_SMALL_FOOTPRINT and provide the binaries if you or someone else would be open to testing it out.

@mtinberg
Copy link

mtinberg commented Feb 5, 2024 via email

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

6 participants