Bug 1983596 (CVE-2021-34558)

Summary: CVE-2021-34558 golang: crypto/tls: certificate of wrong type is causing TLS client to panic
Product: [Other] Security Response Reporter: Dhananjay Arunesh <darunesh>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aadam, aarif, abishop, acui, admiller, agerstmayr, alegrand, alitke, amctagga, amuller, amurdaca, anharris, anpicker, aos-bugs, asm, bbaude, bbennett, bdettelb, bmontgom, bniver, bodavis, caswilli, cnv-qe-bugs, container-sig, dbecker, dbenoit, debarshir, deparker, dornelas, dwalsh, dwhatley, dymurray, ehadley, emachado, eparis, erooth, etamir, fcanogab, fdeutsch, fdupont, fjansen, flucifre, gghezzo, gmeno, godas, gparvin, grafana-maint, gscrivan, hchiramm, hvyas, ibolton, jaharrin, jakob, jarrpa, jbrooks, jburrell, jcajka, jchaloup, jcosta, jeder, jjoyce, jkurik, jligon, jmatthew, jmontleo, jmulligan, jnakfour, jnovy, joelsmith, jokerman, jpadman, jramanat, jschluet, jwendell, jwon, kakkoyun, kaycoth, kconner, kolyshkin, krathod, kwiesmul, lball, lemenkov, lgamliel, lhh, lhinds, lmadsen, lmeyer, lpeer, lsm5, madam, maszulik, matzew, mbenjamin, mburns, mfilanov, mfojtik, mgarciac, mgoodwin, mhackett, mheon, mnewsome, mrunge, mrussell, mthoemme, nalin, nathans, nbecker, nstielau, ocs-bugs, o.lemasle, patrick, patrickm, pehunt, phoracek, pkrupa, pleimer, proguski, pthomas, puebele, rcernich, renich, rfreiman, rh.container.bot, rhcos-triage, rhs-bugs, rhuss, rphillips, rrajasek, rtalur, sabose, santiago, sclewis, security-response-team, sgott, slinaber, slong, slucidi, sostapov, spasquie, sponnaga, sseago, stcannon, stirabos, sttts, tcullum, team-winc, TicoTimo, tnielsen, tomckay, tstellar, tsweeney, twalsh, umohnani, vbatts, vereddy, vkareh, xxia
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: golang 1.17.0, golang 1.16.6, golang 1.15.14 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in golang. A panic can be triggered by an attacker in a privileged network position without access to the server certificate's private key, as long as a trusted ECDSA or Ed25519 certificate for the server exists (or can be issued), or the client is configured with Config.InsecureSkipVerify. Clients that disable all TLS_RSA cipher suites (that is, TLS 1.0–1.2 cipher suites without ECDHE), as well as TLS 1.3-only clients, are unaffected.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-06 01:07:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1991407, 1983597, 1985568, 1985569, 1986037, 1986041, 1986042, 1986043, 1986044, 1986045, 1986046, 1986047, 1986048, 1986049, 1986050, 1986056, 1986057, 1986069, 1986070, 1986071, 1986072, 1986073, 1986079, 1986082, 1986084, 1986197, 1986198, 1986199, 1986200, 1986203, 1986204, 1986242, 1986415, 1986571, 1986975, 1986976, 1987212, 1987213, 1987214, 1987215, 1987737, 1987738, 1987739, 1987740, 1987741, 1987742, 1987791, 1987793, 1987794, 1987810, 1987832, 1989219, 1989241, 1989242, 1989243, 1989244, 1989313, 1989314, 1989315, 1989316, 1990702, 1990714, 1990715, 1990716, 1990717, 1990718, 1990719, 1991364, 1991365, 1991366, 1991367, 1991368, 1991369, 1991370, 1991371, 1991372, 1991373, 1991374, 1991375, 1991376, 1991377, 1991378, 1991379, 1991380, 1991381, 1991382, 1991383, 1991384, 1991385, 1991386, 1991387, 1991388, 1991389, 1991390, 1991391, 1991392, 1991393, 1991394, 1991395, 1991396, 1991397, 1991398, 1991399, 1991400, 1991401, 1991402, 1991403, 1991404, 1991405, 1991406, 1991408, 1991409, 1991410, 1991411, 1991412, 1991413, 1991414, 1991415, 1991416, 1991417, 1991418, 1991419, 1991420, 1991421, 1991422, 1991437, 1992001, 1992002, 1992003, 1992018, 1992019, 1992020, 1992021, 1992022, 1992023, 1992024, 1992025, 1992026, 1992027, 1992028, 1992029, 1992030, 1992031, 1992032, 1992033, 1992034, 1992035, 1992036, 1992037, 1992038, 1992039, 1992040, 1992041, 1992042, 1992043, 1992044, 1992045, 1992046, 1992047, 1992048, 1992049, 1992050, 1992051, 1992055, 1992056, 1992057, 1992058, 1992059, 1992060, 1992061, 1992062, 1992063, 1992064, 1992065, 1992066, 1992067, 1992068, 1992069, 1992070, 1992071, 1992072, 1992073, 1992074, 1992075, 1992076, 1992077, 1992078, 1992079, 1992080, 1992081, 1992082, 1992083, 1992084, 1992085, 1992259, 1992260, 1992261, 1992269, 1999378, 1999379, 2005078, 2057521    
Bug Blocks: 1983600    

Description Dhananjay Arunesh 2021-07-19 07:54:01 UTC
crypto/tls clients can panic when provided a certificate of the wrong type for the negotiated parameters. net/http clients performing HTTPS requests are also affected. The panic can be triggered by an attacker in a privileged network position without access to the server certificate's private key, as long as a trusted ECDSA or Ed25519 certificate for the server exists (or can be issued), or the client is configured with Config.InsecureSkipVerify. Clients that disable all TLS_RSA cipher suites (that is, TLS 1.0–1.2 cipher suites without ECDHE), as well as TLS 1.3-only clients, are unaffected.

References:
https://golang.org/doc/devel/release
https://github.com/golang/go/issues/47145
https://github.com/golang/go/issues/47144

Comment 1 Dhananjay Arunesh 2021-07-19 07:54:35 UTC
Created golang tracking bugs for this issue:

Affects: fedora-all [bug 1983597]

Comment 10 Todd Cullum 2021-07-26 22:30:26 UTC
Created golang tracking bugs for this issue:

Affects: epel-7 [bug 1986200]

Comment 25 Todd Cullum 2021-07-29 16:03:34 UTC
Created buildah tracking bugs for this issue:

Affects: fedora-all [bug 1987738]


Created containernetworking-plugins tracking bugs for this issue:

Affects: fedora-all [bug 1987737]


Created podman tracking bugs for this issue:

Affects: fedora-all [bug 1987739]

Comment 29 Todd Cullum 2021-07-29 16:29:56 UTC
Created runc tracking bugs for this issue:

Affects: fedora-all [bug 1987832]

Comment 31 Todd Cullum 2021-07-29 16:57:17 UTC
Flaw summary:

Code in golang's crypto/tls/key_agreement.go in the generateClientKeyExchange() routine, which is used in the TLS handshake, made an assumption that the provided certificate's public key was of the correct type for TLS_RSA cipher suites:


	encrypted, err := rsa.EncryptPKCS1v15(config.rand(), cert.PublicKey.(*rsa.PublicKey), preMasterSecret)

The patch fixes the issue by first checking for errors when processing the provided public key from the X509 certificate, then if and only if no errors exist, it will begin the encryption process:

	rsaKey, ok := cert.PublicKey.(*rsa.PublicKey)
	if !ok {
		return nil, nil, errors.New("tls: server certificate contains incorrect key type for selected ciphersuite")
	}
	encrypted, err := rsa.EncryptPKCS1v15(config.rand(), rsaKey, preMasterSecret)

Comment 39 errata-xmlrpc 2021-08-05 09:00:39 UTC
This issue has been addressed in the following products:

  Red Hat Developer Tools

Via RHSA-2021:3015 https://access.redhat.com/errata/RHSA-2021:3015

Comment 40 Product Security DevOps Team 2021-08-05 13:07:02 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-34558

Comment 43 Product Security DevOps Team 2021-08-06 01:07:38 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-34558

Comment 48 errata-xmlrpc 2021-08-10 07:50:10 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.8

Via RHSA-2021:2984 https://access.redhat.com/errata/RHSA-2021:2984

Comment 49 errata-xmlrpc 2021-08-10 11:26:55 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.8

Via RHSA-2021:2983 https://access.redhat.com/errata/RHSA-2021:2983

Comment 50 errata-xmlrpc 2021-08-10 13:58:16 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:3076 https://access.redhat.com/errata/RHSA-2021:3076

Comment 58 errata-xmlrpc 2021-08-12 00:38:33 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.6

Via RHSA-2021:3009 https://access.redhat.com/errata/RHSA-2021:3009

Comment 59 errata-xmlrpc 2021-08-12 01:34:55 UTC
This issue has been addressed in the following products:

  RHACS-3.64-RHEL-8

Via RHSA-2021:3146 https://access.redhat.com/errata/RHSA-2021:3146

Comment 62 errata-xmlrpc 2021-08-19 12:33:53 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Jaeger 1.20

Via RHSA-2021:3229 https://access.redhat.com/errata/RHSA-2021:3229

Comment 63 ximhan 2021-08-20 07:44:34 UTC
OpenShift engineering has decided to NOT ship 4.8.6 on 8/23 due to the following issue.
https://bugzilla.redhat.com/show_bug.cgi?id=1995785
All the fixes part will be now included in 4.8.7 on 8/30.

Comment 65 errata-xmlrpc 2021-08-24 12:48:57 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.8

Via RHSA-2021:3259 https://access.redhat.com/errata/RHSA-2021:3259

Comment 67 errata-xmlrpc 2021-08-31 08:09:38 UTC
This issue has been addressed in the following products:

  Red Hat Migration Toolkit for Containers 1.5

Via RHSA-2021:3361 https://access.redhat.com/errata/RHSA-2021:3361

Comment 68 errata-xmlrpc 2021-08-31 14:59:27 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.8

Via RHSA-2021:3248 https://access.redhat.com/errata/RHSA-2021:3248

Comment 69 errata-xmlrpc 2021-09-16 15:21:44 UTC
This issue has been addressed in the following products:

  Openshift Serverless 1 on RHEL 8

Via RHSA-2021:3555 https://access.redhat.com/errata/RHSA-2021:3555

Comment 70 errata-xmlrpc 2021-09-16 18:39:37 UTC
This issue has been addressed in the following products:

  Openshift Serveless 1.17

Via RHSA-2021:3556 https://access.redhat.com/errata/RHSA-2021:3556

Comment 71 errata-xmlrpc 2021-09-21 11:06:10 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.8

Via RHSA-2021:3598 https://access.redhat.com/errata/RHSA-2021:3598

Comment 73 errata-xmlrpc 2021-10-05 17:35:39 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-2.6

Via RHSA-2021:3733 https://access.redhat.com/errata/RHSA-2021:3733

Comment 76 errata-xmlrpc 2021-10-18 17:28:35 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.9

Via RHSA-2021:3759 https://access.redhat.com/errata/RHSA-2021:3759

Comment 77 errata-xmlrpc 2021-10-19 20:20:46 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.8

Via RHSA-2021:3820 https://access.redhat.com/errata/RHSA-2021:3820

Comment 78 errata-xmlrpc 2021-11-02 15:57:05 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.9

Via RHSA-2021:4104 https://access.redhat.com/errata/RHSA-2021:4104

Comment 79 errata-xmlrpc 2021-11-09 17:49:07 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2021:4226 https://access.redhat.com/errata/RHSA-2021:4226

Comment 80 errata-xmlrpc 2021-11-10 11:54:35 UTC
This issue has been addressed in the following products:

  Service Telemetry Framework 1.3 for RHEL 8

Via RHSA-2021:4582 https://access.redhat.com/errata/RHSA-2021:4582

Comment 85 errata-xmlrpc 2021-11-17 15:35:37 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-2.6
  RHEL-7-CNV-2.6

Via RHSA-2021:4722 https://access.redhat.com/errata/RHSA-2021:4722

Comment 86 errata-xmlrpc 2021-11-17 18:39:50 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-2.6

Via RHSA-2021:4725 https://access.redhat.com/errata/RHSA-2021:4725

Comment 88 errata-xmlrpc 2021-12-02 17:00:40 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.8

Via RHSA-2021:4914 https://access.redhat.com/errata/RHSA-2021:4914

Comment 89 errata-xmlrpc 2021-12-13 15:26:32 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Data Foundation 4.9.0 on RHEL-8

Via RHSA-2021:5085 https://access.redhat.com/errata/RHSA-2021:5085

Comment 90 errata-xmlrpc 2021-12-13 17:43:55 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Data Foundation 4.9.0 on RHEL-8

Via RHSA-2021:5086 https://access.redhat.com/errata/RHSA-2021:5086

Comment 91 errata-xmlrpc 2022-01-19 17:49:35 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.9

Via RHSA-2022:0191 https://access.redhat.com/errata/RHSA-2022:0191

Comment 92 errata-xmlrpc 2022-01-24 13:50:55 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 16.2

Via RHSA-2022:0237 https://access.redhat.com/errata/RHSA-2022:0237

Comment 93 errata-xmlrpc 2022-01-25 13:53:26 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 16.1

Via RHSA-2022:0260 https://access.redhat.com/errata/RHSA-2022:0260

Comment 94 errata-xmlrpc 2022-03-16 15:47:43 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.10

Via RHSA-2022:0947 https://access.redhat.com/errata/RHSA-2022:0947

Comment 95 errata-xmlrpc 2022-03-23 22:27:11 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 16.2

Via RHSA-2022:0998 https://access.redhat.com/errata/RHSA-2022:0998

Comment 96 errata-xmlrpc 2022-03-24 10:58:08 UTC
This issue has been addressed in the following products:

  Red Hat OpenStack Platform 16.1

Via RHSA-2022:0988 https://access.redhat.com/errata/RHSA-2022:0988

Comment 97 errata-xmlrpc 2022-03-28 09:35:55 UTC
This issue has been addressed in the following products:

  Red Hat OpenShift Container Platform 4.10

Via RHSA-2022:0577 https://access.redhat.com/errata/RHSA-2022:0577

Comment 98 errata-xmlrpc 2022-04-12 15:07:49 UTC
This issue has been addressed in the following products:

  RHEL-8-CNV-4.8
  RHEL-7-CNV-4.8

Via RHSA-2022:1329 https://access.redhat.com/errata/RHSA-2022:1329

Comment 99 errata-xmlrpc 2022-04-13 18:49:08 UTC
This issue has been addressed in the following products:

  RHODF-4.10-RHEL-8

Via RHSA-2022:1372 https://access.redhat.com/errata/RHSA-2022:1372

Comment 101 errata-xmlrpc 2022-11-15 09:47:45 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2022:7954 https://access.redhat.com/errata/RHSA-2022:7954