Bug 1975718

Summary: mschapv2 (md4 hash) 8021x inner authentication does not work
Product: Red Hat Enterprise Linux 9 Reporter: Vladimir Benes <vbenes>
Component: wpa_supplicantAssignee: Davide Caratti <dcaratti>
Status: CLOSED CURRENTRELEASE QA Contact: Ken Benoit <kbenoit>
Severity: unspecified Docs Contact: Petr Hybl <phybl>
Priority: unspecified    
Version: 9.0CC: bgalvani, dcaratti, fdvorak, igkioka, lkuprova, pvlasin, rvr, sukulkar, tpelka
Target Milestone: betaKeywords: TestBlocker, Triaged
Target Release: 9.0 BetaFlags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: wpa_supplicant-2.9-17.el9 Doc Type: Bug Fix
Doc Text:
.Wifi and 802.1x Ethernet connections profiles are now connecting properly Previously, many Wifi and 802.1x Ethernet connections profiles were not able to connect. This bug is now fixed. All the profiles are now connecting properly. Profiles that use legacy cryptographic algorithms still work but you need to manually enable the OpenSSL legacy provider. This is required, for example, when you use DES with MS-CHAPv2 and RC4 with TKIP.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:33:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Vladimir Benes 2021-06-24 09:39:18 UTC
Description of problem:
between composes 171 and 213 of RHEL9 (where a major openssl3 update happened) we see a lot of 8021x tests failing, we think it has to do something with mschapv2 and md4 hash inside. 

Beniamino's ltrace of wpa_supplicant: http://file.rdu.redhat.com/~bgalvani/trace.out.bz2 . If you grep the last occurences of "EVP", you can see that first it does SHA1 and then MD4. The latter fails. Looking better at wpa_supplicant sources, it seems that MS-CHAPv2 uses both SHA1 and MD4. So the problem is probably that MD4 is disabled.

Version-Release number of selected component (if applicable):
openssl-3.0.0-0.alpha15.1.el9.x86_64

How reproducible:
always

Steps to Reproduce:
1. ./test_run.sh 8021x_peap_mschapv2_doc_procedure

from NMCI test suite
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci

!destructive, run in VM dedicated to the suite!

Comment 1 Vladimir Benes 2021-06-24 09:41:53 UTC
*** Bug 1974884 has been marked as a duplicate of this bug. ***

Comment 2 Beniamino Galvani 2021-06-24 09:49:31 UTC
Also the test using PEAP-GTC fails, apparently because RC4 is disabled in OpenSSL:

Jun 24 05:46:18 wpa_supplicant[35086]: WPA: PTK derivation using PRF(SHA1)
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: PTK derivation - A1=02:00:00:00:00:00 A2=02:00:00:00:01:04
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: Nonce1 - hexdump(len=32): 07 b0 c3 61 cc 92 37 00 75 c9 8a e3 ff 95 8e d0 f4 f1 06 87 cb 26 68 4e 66 72 a3 b2 01 54 c0 1f
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: Nonce2 - hexdump(len=32): 10 16 32 b4 da 7c cb f8 86 11 e7 88 2b 65 13 06 b9 90 bf a1 3a e0 21 b8 44 18 7f 3d 50 12 e0 7b
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: PMK - hexdump(len=32): 4a 78 42 84 2b ff 7a ca c8 a4 8e 10 5f 5e 77 77 e6 f7 2d a2 59 b8 70 9d c8 9d de 98 c4 ed fe 72
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: PTK - hexdump(len=64): d6 61 a4 bd 38 9c 96 00 46 ed a4 35 3d 2a 10 1c 91 51 d4 21 29 7a 3b 19 f6 fc 40 95 e6 d6 3f ea 81 d8 01 20 99 63 6b e9 3f 0d 29 >
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: KCK - hexdump(len=16): d6 61 a4 bd 38 9c 96 00 46 ed a4 35 3d 2a 10 1c
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: KEK - hexdump(len=16): 91 51 d4 21 29 7a 3b 19 f6 fc 40 95 e6 d6 3f ea
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: TK - hexdump(len=32): 81 d8 01 20 99 63 6b e9 3f 0d 29 f9 73 27 fe 8f 62 32 4d 42 fa 00 99 9a 09 4b 00 3b 61 f5 80 36
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: WPA IE for msg 2/4 - hexdump(len=40): 30 26 01 00 00 0f ac 02 01 00 00 0f ac 02 01 00 00 0f ac 01 80 00 01 00 f1 03 34 f1 c2 ab 47 93 b4 e5 30 3a 17 29 >
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: Replay Counter - hexdump(len=8): 00 00 00 00 00 00 00 01
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0: WPA: Sending EAPOL-Key 2/4
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: Send EAPOL-Key frame to 02:00:00:00:01:04 ver=1 mic_len=16 key_mgmt=0x1
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: EAPOL-Key MIC using HMAC-MD5
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: KCK - hexdump(len=16): d6 61 a4 bd 38 9c 96 00 46 ed a4 35 3d 2a 10 1c
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: Derived Key MIC - hexdump(len=16): cb ba 2d ab c3 9e be d3 54 37 17 c1 6c 6c 80 fb
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: TX EAPOL-Key - hexdump(len=139): 01 03 00 87 02 01 09 00 00 00 00 00 00 00 00 00 01 07 b0 c3 61 cc 92 37 00 75 c9 8a e3 ff 95 8e d0 f4 f1 06 87 cb 26 68>
Jun 24 05:46:18 wpa_supplicant[35086]: l2_packet_receive: src=02:00:00:00:01:04 len=193
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0: RX EAPOL from 02:00:00:00:01:04
Jun 24 05:46:18 wpa_supplicant[35086]: RX EAPOL - hexdump(len=193): 01 03 00 bd 02 13 c9 00 20 00 00 00 00 00 00 00 02 10 16 32 b4 da 7c cb f8 86 11 e7 88 2b 65 13 06 b9 90 bf a1 3a e0 21 b8 44 18>
Jun 24 05:46:18 wpa_supplicant[35086]: EAPOL: Ignoring WPA EAPOL-Key frame in EAPOL state machines
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0: IEEE 802.1X RX: version=1 type=3 length=189
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: RX EAPOL-Key - hexdump(len=193): 01 03 00 bd 02 13 c9 00 20 00 00 00 00 00 00 00 02 10 16 32 b4 da 7c cb f8 86 11 e7 88 2b 65 13 06 b9 90 bf a1 3a e0 21>
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0:   EAPOL-Key type=2
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0:   key_info 0x13c9 (ver=1 keyidx=0 rsvd=0 Pairwise Install Ack MIC Secure Encr)
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0:   key_length=32 key_data_length=94
Jun 24 05:46:18 wpa_supplicant[35086]:   replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 02
Jun 24 05:46:18 wpa_supplicant[35086]:   key_nonce - hexdump(len=32): 10 16 32 b4 da 7c cb f8 86 11 e7 88 2b 65 13 06 b9 90 bf a1 3a e0 21 b8 44 18 7f 3d 50 12 e0 7b
Jun 24 05:46:18 wpa_supplicant[35086]:   key_iv - hexdump(len=16): 23 1e c8 11 ef 43 35 2c 0b 35 1f 86 b7 90 2d ef
Jun 24 05:46:18 wpa_supplicant[35086]:   key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00
Jun 24 05:46:18 wpa_supplicant[35086]:   key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00
Jun 24 05:46:18 wpa_supplicant[35086]:   key_mic - hexdump(len=16): 4c d4 21 dc bd 9d 8f 0c 50 dc 75 5b c2 78 97 d9
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: EAPOL-Key MIC using HMAC-MD5
Jun 24 05:46:18 wpa_supplicant[35086]: RSN: encrypted key data - hexdump(len=94): cc 40 5d 71 b7 28 9f 8e be d2 24 18 1c a5 03 54 12 71 3a 62 45 ac e2 6e c6 32 71 df f6 5d e0 c7 8f e3 3b 21 0e 84 >
Jun 24 05:46:18 wpa_supplicant[35086]: WPA: Decrypt Key Data using RC4
Jun 24 05:46:18 wpa_supplicant[35086]: wlan0: WPA: RC4 failed <-----------------------------------------------

Comment 3 Beniamino Galvani 2021-06-24 09:54:37 UTC
Error in the PEAP-MSCHAP-v2 test:

Jun 24 02:20:58 wpa_supplicant[21926]: OpenSSL: EVP_DigestInit_ex failed: error:0308010C:digital envelope routines::unsupported
Jun 24 02:20:58 wpa_supplicant[21926]: EAP-MSCHAPV2: Failed to derive response

Relevant ltrace of wpa_supplicant:

EVP_sha1(0x55744ca0754a, 0x55744ca263fa, 0x55744ca1bf08, 13)                           = 0x7f48f7d5f520 <--------- SHA1
EVP_MD_CTX_new(0x7f48f7d5f520, 3, 0x7ffcd296c3d0, 0x7ffcd296c3b0)                      = 0x55744ca803f0
EVP_DigestInit_ex(0x55744ca803f0, 0x7f48f7d5f520, 0, 0x55744c9825b0)                   = 1 <---------------------- init OK
EVP_DigestUpdate(0x55744ca803f0, 0x55744ca0754a, 16, 0x55744ca2ef80)                   = 1
EVP_DigestUpdate(0x55744ca803f0, 0x55744ca263fa, 16, 0)                                = 1
EVP_DigestUpdate(0x55744ca803f0, 0x55744ca1bf08, 13, 0)                                = 1
EVP_DigestFinal(0x55744ca803f0, 0x7ffcd296c3f0, 0x7ffcd296c364, 0x327670616863736d)    = 1
EVP_MD_CTX_free(0x55744ca803f0, 0, 5, 0x55711be625ae)                                  = 0
EVP_md4(0x55744ca1b510, 8, 0x7ffcd296c1fe, 100)                                        = 0x7f48f7d5f920 <---------- MD4
EVP_MD_CTX_new(0x7f48f7d5f920, 1, 0x7ffcd296c1e8, 0x7ffcd296c1e0)                      = 0x55744ca803f0
EVP_DigestInit_ex(0x55744ca803f0, 0x7f48f7d5f920, 0, 0x55744c9825b0)                   = 0  <---------------------- init error
ERR_get_error(16, 0, 0, 0x55744c98b150)                                                = 0x308010c
ERR_error_string(0x308010c, 0, 129, 0x7f48f7ca6485)

Comment 22 Ken Benoit 2021-09-01 17:19:07 UTC
Ran verification regression testing against RHEL-9.0.0-20210830.9. Testing passed without issue. Marking as verified.