Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1197666 - ssh client using HostbasedAuthentication aborts in FIPS mode
ssh client using HostbasedAuthentication aborts in FIPS mode
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openssh (Show other bugs)
7.2
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: Jakub Jelen
Stanislav Zidek
: Patch
Depends On: 1197072
Blocks: 1205796 1191021
  Show dependency treegraph
 
Reported: 2015-03-02 05:57 EST by Jakub Jelen
Modified: 2016-02-09 03:30 EST (History)
4 users (show)

See Also:
Fixed In Version: openssh-6.6.1p1-14.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1197072
Environment:
Last Closed: 2015-11-19 03:02:53 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2088 normal SHIPPED_LIVE Moderate: openssh security, bug fix, and enhancement update 2015-11-19 03:38:51 EST

  None (edit)
Description Jakub Jelen 2015-03-02 05:57:22 EST
+++ This bug was initially created as a clone of Bug #1197072 +++

Description of problem:
ssh client aborts with HostbasedAuthentication fails if there is /etc/ssh/ssh_host_key present. This is somehow similar to bz1009959.

Version-Release number of selected component (if applicable):
openssh-5.3p1-105.el6

How reproducible:
always

Steps to Reproduce:
1. setup hostbased authentication for server
2. ssh -p 6296 -o PubkeyAuthentication=no -o BatchMode=yes -o HostbasedAuthentication=yes -v <USER>@<SERVER>

Actual results:
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
FIPS mode initialized
debug1: Connecting to sheep-29.lab.eng.brq.redhat.com [10.34.88.29] port 6296.
debug1: Connection established.
md5_dgst.c(78): OpenSSL internal error, assertion failed: Digest MD5 forbidden in FIPS mode!
Aborted (core dumped)

Expected results:
no core dump, authentication success

Additional info:
If I just remove /etc/ssh/ssh_host_key, everything works fine.

Configuration:

I am using same machine for both server and client for simplicity.
* add these lines to default /etc/ssh/sshd_config
HostbasedAuthentication yes
HostbasedUsesNameFromPacketOnly yes
IgnoreRhosts no
* add machine to global known_hosts
ssh-keyscan <HOSTNAME> >/etc/ssh/ssh_known_hosts
* add root to user's ~/.shosts file
# su - <USER> -c -c 'echo "<HOSTNAME> root" >.shosts; chmod 600 .shosts'

Backtrace:
(gdb) bt
#0  0x00007fb4b613e625 in raise () from /lib64/libc.so.6
#1  0x00007fb4b613fe05 in abort () from /lib64/libc.so.6
#2  0x00007fb4b7c25fbf in OpenSSLDie () from /usr/lib64/libcrypto.so.10
#3  0x00007fb4b7c2c729 in MD5_Init () from /usr/lib64/libcrypto.so.10
#4  0x00007fb4b860f85c in cipher_set_key_string (cc=0x7fff7c31a4d0, cipher=0x7fb4b884f4e0, 
    passphrase=0x7fb4b8640602 "", do_encrypt=0) at cipher.c:314
#5  0x00007fb4b8603a47 in key_load_private_rsa1 (fd=4, filename=0x7fb4b8631e2d "/etc/ssh/ssh_host_key", 
    passphrase=0x7fb4b8640602 "", commentp=0x0) at authfile.c:430
#6  0x00007fb4b85ee36a in main (ac=<value optimized out>, av=<value optimized out>) at ssh.c:829

I am attaching patch that solves problem for me.

--- Additional comment from Jakub Jelen on 2015-03-01 20:30:30 CET ---

This makes sense to me. We can't load RSA1 key in FIPS mode. Also sounds reasonable for RHEL-6.7.
But there is that comment "closes fd" so we should close fd as well even if we are in fips mode (as it is solved in your referenced bugzilla). Also we need to return and not to let it fallback into key_load_private_pem and generate errors

Unfortunately, I don't have FIPS machine around. Stanislav, can you try it with this patch?

--- Additional comment from Jakub Jelen on 2015-03-02 11:53:14 CET ---

OK. Tested with rhel6 and it solves this issue for me.

This issue applies also for rhel7 in this border condition so I'm cloning bug to rhel7.
Comment 3 Jakub Jelen 2015-05-07 09:53:35 EDT
We spend some time with Stanislav discussing this test case recently. Based on my observation this is not reproducible on RHEL 7 (not like it was on the first sight when I was cloning this bugzilla).

Stanislav, I think we can close this, if you agree.

It has been fixed with bz1111588 (better fix than on rhel6):
diff --git a/authfile.c b/authfile.c
index ec4f4ff..2b3d650 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1080,9 +1081,10 @@ key_parse_private(Buffer *buffer, const char *filename,
            *commentp = xstrdup(filename);
    } else {
        key_free(pub);
-       /* key_parse_public_rsa1() has already loaded the comment */
-       prv = key_parse_private_type(buffer, KEY_RSA1, passphrase,
-           NULL);
+       if (! FIPS_mode())
+           /* key_parse_public_rsa1() has already loaded the comment */
+           prv = key_parse_private_type(buffer, KEY_RSA1, passphrase,
+               NULL);
    }
    return prv;
 }
Comment 9 errata-xmlrpc 2015-11-19 03:02:53 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-2088.html

Note You need to log in before you can comment on or make changes to this bug.