Security Advisory

CVE-2018-16151: strongSwan gmp RSA Signature Forgery

Last updated:
  • CVE-2018-16151

CVE-2018-16151 is an RSA signature verification flaw in the gmp plugin of strongSwan 4.x and 5.x before 5.7.0: the parser accepts random bytes after the hash algorithm OID, so an attacker can forge PKCS#1 v1.5 signatures for keys with public exponent 3 and impersonate an IKEv2 peer. NVD scores it 7.5; strongSwan 5.7.0 fixes it.

Vulnerability summary

CVSS base score

7.5

High severity

EPSS score (FIRST)

1.9%

Probability of exploitation in the wild in the next 30 days

CISA KEV catalog

No

Not listed

Published

Vulnerability ID: CVE-2018-16151 · Source: NVD

Affected components

ComponentCPEVersion range
strongSwan (gmp plugin)cpe:2.3:a:strongswan:strongswan:*:*:*:*:*:*:*:*NVD: 4.0.0 to 4.6.4 and 5.0.0 to before 5.7.0; fixed in 5.7.0, patches for older releases from 4.4.0 (strongSwan advisory); only builds that load the gmp plugin
OpenWrt packages feed: strongswancpe:2.3:a:strongswan:strongswan:*:*:*:*:*:*:*:*upstream gmp patches backported 2018-10-05, then updated to 5.7.0 on 2018-10-07; strongswan-default pulls in strongswan-mod-gmp (read 2026-11-18)
Buildroot strongswan packagecpe:2.3:a:strongswan:strongswan:*:*:*:*:*:*:*:*upstream security patch added 2018-10-01; GNU MP is the default cryptographic backend in the package menu (read 2026-11-18)

What does this mean for affected devices?

The strongSwan advisory of 24 September 2018 describes several flaws in how the gmp plugin parses and verifies RSA signatures. Its ASN.1 OID parser "allows any number of random bytes after a valid OID": asn1_known_oid() stops at the first known leaf and ignores the rest. That gap is CVE-2018-16151; the companion flaw, an unchecked parameters field in the algorithmIdentifier, is CVE-2018-16152. The plugin also accepted signatures with less than 8 bytes of padding, which has no CVE of its own but makes the other flaws easier to exploit. Together they allow a Bleichenbacher-style low-exponent forgery.

The attack needs a key with public exponent e=3. strongSwan says an attacker can create arbitrary certificates if a CA certificate uses such a key, or authenticate as a peer whose end-entity certificate or raw public key does, and "does not need to know the actual public key, just the key length". Remote code execution is not possible. NVD's Primary score is CVSS v3.0 7.5 (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N) with CWE-347, improper verification of cryptographic signature; CISA's ADP entry gives the same 7.5 in CVSS v3.1. NVD's CPE ranges are 4.0.0 to 4.6.4 and 5.0.0 up to, but excluding, 5.7.0 (NVD).

Do router and gateway builds load the gmp plugin?

Often, yes. On 2026-11-18 the strongswan-default package in the OpenWrt packages feed depends on strongswan-mod-gmp, and the Buildroot strongswan package menu selects GNU MP as the default cryptographic backend. The exposure then turns on the keys: per the advisory, keys generated with strongSwan's own pki --gen always used e=65537 and are not affected, while an e=3 key in any CA or peer certificate the gateway trusts is.

Which firmware build systems carry the fix?

Buildroot and OpenWrt patched it within two weeks of the advisory. Buildroot added the upstream security patch on 2018-10-01, citing CVE-2018-16151 and CVE-2018-16152. OpenWrt backported the gmp fixes on 2018-10-05, together with CVE-2018-17540, and updated the package to 5.7.0 two days later. Distributions fixed their own builds: the Debian security tracker lists DSA-4305-1 (stretch, 5.5.1-4+deb9u3) and DLA-1522-1 (jessie, 5.2.1-6+deb8u7). A gateway image built from an older feed or SDK snapshot can still carry the unpatched plugin, so check the strongSwan version string and the patch list together.

How do you fix or mitigate CVE-2018-16151?

Upgrade to strongSwan 5.7.0 or later, or apply the patch strongSwan publishes for older releases (it provides none for versions before 4.4.0). Where neither is possible, the advisory gives two mitigations: an installation that does not load the gmp plugin is not vulnerable, and one that loads it is safe when no key or certificate in use, CA certificates included, has e=3.

This is the oldest strongSwan flaw in our OpenVPN and strongSwan firmware guide, which shows how to find the VPN stack and version in an image. Newer strongSwan issues are covered in CVE-2023-41913, a charon-tkm buffer overflow, and CVE-2026-78135, a Child SA created before authentication; for OpenVPN see CVE-2025-13086. Our patch management guide covers rolling a fixed package out to a device fleet.

CVE-2018-16151 is not in the CISA KEV catalog as of 2026-11-18 (catalog version 2026.11.17). FIRST EPSS gives it 0.01888, the 80th percentile, in the 2026-11-17 dataset (CISA KEV, FIRST EPSS).

How to fix this class of issueNo dedicated SoftWSP guide covers this weakness class; the fix is usually the vendor patch or firmware update referenced above. Our related guide explains how to plan and verify it: NIST SP 800-40 Rev. 4: enterprise patch management planning, explained.

Evidence

  • strongSwan advisory 2018-09-24: OID parser in the gmp plugin allows any number of random bytes after a valid OID (CVE-2018-16151); algorithmIdentifier parameters not enforced (CVE-2018-16152); padding under 8 bytes accepted; forgery needs low-exponent (e=3) keys, attacker needs only the key length; no remote code execution; installations without the gmp plugin not vulnerable; pki --gen always used e=65537; fixed in 5.7.0; patches for older releases, none for versions < 4.4.0. — strongSwan
  • NVD Primary CVSS 3.0 7.5 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N; CISA-ADP CVSS 3.1 7.5 same metrics; CWE-347; CPE strongswan 4.0.0 to 4.6.4 and 5.0.0 to <5.7.0; published 2018-09-26. — NVD
  • Buildroot commit 5e04cdde (2018-10-01) strongswan: add upstream security patch, fixes CVE-2018-16151 and CVE-2018-16152; Config.in on master selects BR2_PACKAGE_STRONGSWAN_GMP as the default cryptographic backend (read 2026-11-18). — Buildroot
  • OpenWrt packages commit fe973d18 (2018-10-05) strongswan: backport upstream fixes for CVEs in gmp plugin (CVE-2018-16151, CVE-2018-16152, CVE-2018-17540); commit 172ae80b (2018-10-07) bump to 5.7.0; strongswan-default depends on strongswan-mod-gmp on master (read 2026-11-18). — OpenWrt packages feed
  • Debian: fixed in jessie 5.2.1-6+deb8u7 (DLA-1522-1), stretch 5.5.1-4+deb9u3 (DSA-4305-1), unstable 5.7.0-1. — Debian security tracker
  • Not in the CISA KEV catalog, version 2026.11.17, checked 2026-11-18. — CISA KEV
  • EPSS 0.01888, percentile 0.79906, dataset 2026-11-17. — FIRST EPSS

Related advisories

Sources

  1. NVD
  2. strongSwan security advisory: CVE-2018-16151, gmp plugin signature verification
  3. Buildroot: strongswan upstream security patch for CVE-2018-16151 and CVE-2018-16152
  4. Buildroot strongswan package configuration
  5. OpenWrt packages: strongswan gmp plugin CVE backport
  6. OpenWrt packages: strongswan Makefile
  7. Debian security tracker: CVE-2018-16151
  8. CISA KEV
  9. FIRST EPSS

Frequently asked questions

Which strongSwan versions are affected by CVE-2018-16151?

strongSwan 4.x and 5.x before 5.7.0 that load the gmp plugin. NVD's ranges are 4.0.0 to 4.6.4 and 5.0.0 up to, but excluding, 5.7.0. strongSwan 5.7.0 fixes it, and strongSwan publishes patches for older releases from 4.4.0 (per the strongSwan advisory and NVD).

Is a gateway safe if its keys use exponent 65537?

Yes for this flaw. The forgery only works against RSA keys with a low public exponent such as e=3, in a CA certificate or a peer's certificate or raw public key. strongSwan notes that keys made with its pki --gen tool always used e=65537 and are not affected, even with an unpatched gmp plugin.

Do OpenWrt and Buildroot builds include the affected gmp plugin?

On 2026-11-18 OpenWrt's strongswan-default package depends on strongswan-mod-gmp, and Buildroot's strongswan package selects GNU MP as its default cryptographic backend. Both build systems patched the flaw in October 2018, so current feeds are fixed; older SDK snapshots may not be.

Is CVE-2018-16151 in the CISA KEV catalog?

No, not as of 2026-11-18 (catalog version 2026.11.17). FIRST EPSS gives it 0.01888, the 80th percentile, in the 2026-11-17 dataset (per CISA KEV and FIRST EPSS).