RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1197666 - ssh client using HostbasedAuthentication aborts in FIPS mode
Summary: ssh client using HostbasedAuthentication aborts in FIPS mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openssh
Version: 7.2
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jakub Jelen
QA Contact: Stanislav Zidek
URL:
Whiteboard:
Depends On: 1197072
Blocks: 1191021 1205796
TreeView+ depends on / blocked
 
Reported: 2015-03-02 10:57 UTC by Jakub Jelen
Modified: 2016-02-09 08:30 UTC (History)
4 users (show)

Fixed In Version: openssh-6.6.1p1-14.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1197072
Environment:
Last Closed: 2015-11-19 08:02:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2088 0 normal SHIPPED_LIVE Moderate: openssh security, bug fix, and enhancement update 2015-11-19 08:38:51 UTC

Description Jakub Jelen 2015-03-02 10:57:22 UTC
+++ 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 13:53:35 UTC
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 08:02:53 UTC
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.