Bugzilla – Bug 1107874
VUL-0: CVE-2018-16151, CVE-2018-16152: strongswan: several flaws in the gmp plugin that may lead to an authorization bypass vulnerability
Last modified: 2022-03-04 12:29:29 UTC
Created attachment 782661 [details] strongswan-4.4.0-4.4.1_gmp-pkcs1-verify.patch Dear strongSwan partner, A security researcher privately reported several flaws in the gmp plugin that may lead to an authorization bypass vulnerability. # Insufficient input validation in gmp plugin Several flaws in the implementation that parsed and verified RSA signatures in the gmp plugin may allow for a Bleichenbacher-style low-exponent signature forgery in certificates and during IKE authentication. Potentially affected are all strongSwan versions including the latest 5.6.3. CVE-2018-16151 and CVE-2018-16152 have been assigned for two of the flaws that may lead to this vulnerability (see below for details). To verify an RSA signature it is decrypted using the public key with the operation m^e mod n, where m is the signature value, and e and n are the exponent and modulus of the public key, respectively. When using PKCS#1 v1.5 the result of that calculation is a binary number that has a very specific form: 0x00 || 0x01 || PS || 0x00 || T Where T is an ASN.1 encoded digestInfo (algorithmIdentifier with the OID of the used hash function followed by the binary hash value) and the padding PS consists of at least 8 bytes of 0xFF to make sure the resulting value consists of exactly the same number of bytes as the modulus. Already in 2006 Daniel Bleichenbacher showed that it is possible to easily forge signatures for low-exponent keys (i.e. with e=3) if the implementation fails to verify that there is enough padding to ensure that T is right-aligned and if it allows arbitrary data after the hash. While the implementation in the gmp plugin was not vulnerable to the latter (i.e. it didn't allow data after the ASN.1 structure) further research (e.g. in [1]) showed that the ASN.1 structure may offer similar room for variance if the implementation verifying it is not strict enough. Since our ASN.1 parsing code is mainly designed to accept all kinds of keys and certificates etc. it is pretty lenient, which lead to the following issues. The first is that the OID parser allows any number of random bytes after a valid OID. The asn1_known_oid() function just parses until it finds a leaf in the tree of known OIDs, any further data that follows is simply ignored. And the function that parses ASN.1 algorithmIdentifier structures doesn't care if the full OID data was parsed as it usually doesn't really matter. CVE-2018-16151 has been assigned to this issue. The second problem is that the algorithmIdentifier structure not only contains the OID but also an optional parameters field. While none of the algorithms used with PKCS#1 use parameters, i.e. the field should always be encoded as ASN.1 NULL value, our parser does not enforce this, it simply skips over the parameters. This allows an attacker to fill the field with random data. CVE-2018-16152 has been assigned to this issue. Additionally, the implementation did not enforce at least 8 bytes of padding, actually it was perfectly fine to accept signatures without any padding at all. This does not immediately lead to a vulnerability in itself (hence no separate CVE is assigned) but it makes exploiting the other flaws much easier. An attacker may use these flaws to generate forged signatures in order to generate arbitrary certificates if a CA certificate uses a low-exponent key or authenticate as a particular peer if that peer's end-entity certificate or raw public key uses a low-exponent. It's important to note that the attacker does not need to know the actual public key, just the key length (which could be guessed). Such a forged signature will be accepted by any key with the same length and low exponent. More details on exploiting these flaws (the second in particular) may be found in section 5 of [1]. Remote code execution is not possible due to these issues. # Mitigation Since only the gmp plugin is affected, installations that don't have this plugin enabled and loaded are not vulnerable. If the plugin is loaded, make sure that none of the employed keys and certificates (including those of CAs) use keys with e = 3. Our own tool to generate keys (pki --gen) always used e = 65537 (0x10001), which is not vulnerable, so certificates and keys generated with this tool are fine for use even with an unpatched gmp plugin. The attached patches fix the vulnerability in the respective strongSwan versions and should apply with appropriate hunk offsets (please note that patches for versions < 4.4.0 are not provided). In order to apply them those for CVE-2012-2388 [2] (versions <= 4.6.3) and CVE-2017-11185 [3] (versions <= 5.5.3) must be applied already. Please prepare updated releases and patch your installations, but do not yet publicly disclose any information about this vulnerability. We want to give you as a partner enough time to prepare new releases and will publicly disclose the vulnerability with the strongSwan 5.7.0 release on Mon Sep 24, 14:00 CEST. Credit to Sze Yiu Chau and his team from Purdue University and The University of Iowa for finding this vulnerability. More details will be released in their research paper later this year. Our apologies for the inconvenience. Kind Regards Tobias Brunner strongSwan Developer [1] Variants of Bleichenbacher's Low-Exponent Attack on PKCS#1 RSA Signatures http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.698.7230 [2] https://download.strongswan.org/security/CVE-2012-2388 [3] https://download.strongswan.org/security/CVE-2017-11185
Created attachment 782662 [details] strongswan-4.5.1-5.0.0_gmp-pkcs1-verify.patch
Created attachment 782663 [details] strongswan-5.0.1-5.3.0_gmp-pkcs1-verify.patch
Created attachment 782664 [details] strongswan-5.3.1-5.6.0_gmp-pkcs1-verify.patch
Created attachment 782665 [details] strongswan-5.6.1-5.6.3_gmp-pkcs1-verify.patch
CRD: 2018-09-24 14:00 CEST
There was an issue with the patches for versions < 5.0.1 (due to the changed return type of the allocate_hash() method). I've uploaded updated patches for these versions to [1]. Regards, Tobias [1] https://download.strongswan.org/patches/27_gmp_pkcs1_verify_patch/
There is another vulnerability that was introduced with the fix: Bug 1109845 -> CVE-2018-17540
SUSE-SU-2019:3056-1: An update that fixes 5 vulnerabilities is now available. Category: security (important) Bug References: 1093536,1094462,1107874,1109845 CVE References: CVE-2018-10811,CVE-2018-16151,CVE-2018-16152,CVE-2018-17540,CVE-2018-5388 Sources used: SUSE Linux Enterprise Module for Packagehub Subpackages 15 (src): strongswan-5.6.0-4.3.2 SUSE Linux Enterprise Module for Open Buildservice Development Tools 15-SP1 (src): strongswan-5.6.0-4.3.2 SUSE Linux Enterprise Module for Open Buildservice Development Tools 15 (src): strongswan-5.6.0-4.3.2 SUSE Linux Enterprise Module for Basesystem 15-SP1 (src): strongswan-5.6.0-4.3.2 SUSE Linux Enterprise Module for Basesystem 15 (src): strongswan-5.6.0-4.3.2 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
openSUSE-SU-2019:2594-1: An update that fixes 5 vulnerabilities is now available. Category: security (important) Bug References: 1093536,1094462,1107874,1109845 CVE References: CVE-2018-10811,CVE-2018-16151,CVE-2018-16152,CVE-2018-17540,CVE-2018-5388 Sources used: openSUSE Leap 15.0 (src): strongswan-5.6.0-lp150.3.3.1
openSUSE-SU-2019:2598-1: An update that fixes 5 vulnerabilities is now available. Category: security (important) Bug References: 1093536,1094462,1107874,1109845 CVE References: CVE-2018-10811,CVE-2018-16151,CVE-2018-16152,CVE-2018-17540,CVE-2018-5388 Sources used: openSUSE Leap 15.1 (src): strongswan-5.6.0-lp151.4.3.1
SUSE-SU-2019:3266-1: An update that solves 5 vulnerabilities and has one errata is now available. Category: security (important) Bug References: 1009254,1071853,1093536,1094462,1107874,1109845 CVE References: CVE-2018-10811,CVE-2018-16151,CVE-2018-16152,CVE-2018-17540,CVE-2018-5388 Sources used: SUSE OpenStack Cloud 8 (src): strongswan-5.1.3-26.13.1 SUSE OpenStack Cloud 7 (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server for SAP 12-SP3 (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server for SAP 12-SP2 (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server for SAP 12-SP1 (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP5 (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP4 (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP3-LTSS (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP3-BCL (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP2-LTSS (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP2-BCL (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Server 12-SP1-LTSS (src): strongswan-5.1.3-26.13.1 SUSE Linux Enterprise Desktop 12-SP4 (src): strongswan-5.1.3-26.13.1 SUSE Enterprise Storage 5 (src): strongswan-5.1.3-26.13.1 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
Please ack and forward https://build.opensuse.org/request/show/761676 That way we can have this CVE fixed in Tumbleweed too.....
This is an autogenerated message for OBS integration: This bug (1107874) was mentioned in https://build.opensuse.org/request/show/767305 Factory / strongswan
Hi Manuel, submission for SUSE:SLE-11-SP1:Update is missing. Can you please provide it?
SUSE-SU-2022:14887-1: An update that fixes four vulnerabilities is now available. Category: security (important) Bug References: 1107874,1109845,1194471 CVE References: CVE-2018-16151,CVE-2018-16152,CVE-2018-17540,CVE-2021-45079 JIRA References: Sources used: SUSE Linux Enterprise Server 11-SP4-LTSS (src): strongswan-4.4.0-6.36.12.1 SUSE Linux Enterprise Point of Sale 11-SP3 (src): strongswan-4.4.0-6.36.12.1 SUSE Linux Enterprise Debuginfo 11-SP4 (src): strongswan-4.4.0-6.36.12.1 SUSE Linux Enterprise Debuginfo 11-SP3 (src): strongswan-4.4.0-6.36.12.1 NOTE: This line indicates an update has been released for the listed product(s). At times this might be only a partial fix. If you have questions please reach out to maintenance coordination.
released