Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions SPECS/strongswan/CVE-2026-78123.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From b3d479d00ab4617128b9a654b880c012c214aaf3 Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Mon, 1 Jun 2026 17:51:35 +0200
Subject: [PATCH] openssl: Fix undefined memory access when verifying PKCS#7
containers

If the signerInfo or recipientInfo structure doesn't contain
issuerAndSerialNumber but instead a subjectKeyIdentifier, then the called
functions will leave the passed name and serial numbers unchanged. While
openssl_x509_name2id() prevents a NULL-pointer dereference, it tries to
DER-encode the object at the passed pointer via i2d_X509_NAME().
Depending on the stack contents, this likely causes a segmentation fault.

Fixes: 3c820cdc232a ("Implement PKCS#7 decryption using openssl")
Fixes: c61723c69fb5 ("Implement OpenSSL PKCS#7 signed-data parsing and verification")
Fixes: CVE-2026-78123
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
Upstream-reference: https://download.strongswan.org/security/CVE-2026-78123/strongswan-5.0.2-6.0.7_openssl_pkcs7_info_init.patch
---
src/libstrongswan/plugins/openssl/openssl_pkcs7.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
index d9abcf8..b15c8d7 100644
--- a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
+++ b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
@@ -222,8 +222,8 @@ static auth_cfg_t *verify_signature(CMS_SignerInfo *si,
auth_cfg_t *auth, *found = NULL;
identification_t *issuer, *serial;
chunk_t attrs = chunk_empty, sig, attr;
- X509_NAME *name;
- ASN1_INTEGER *snr;
+ X509_NAME *name = NULL;
+ ASN1_INTEGER *snr = NULL;
int i;

if (CMS_SignerInfo_get0_signer_id(si, NULL, &name, &snr) != 1)
@@ -628,8 +628,8 @@ static bool decrypt(private_openssl_pkcs7_t *this,
identification_t *serial, *issuer;
private_key_t *private;
X509_ALGOR *alg;
- X509_NAME *name;
- ASN1_INTEGER *sn;
+ X509_NAME *name = NULL;
+ ASN1_INTEGER *sn = NULL;
u_char zero = 0;
int oid;

--
2.45.4

34 changes: 34 additions & 0 deletions SPECS/strongswan/CVE-2026-78124.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 142daf52f46889f2eb22df97507a6015a6ea3264 Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Mon, 15 Jun 2026 16:02:01 +0200
Subject: [PATCH] openssl: Fix memory leaks after enumerating certificates in
PKCS#7 container

This can be triggered via IKEv1.

Fixes: 04884be3b5f7 ("Implement openssl PKCS#7 certficiate enumeration")
Fixes: CVE-2026-78124
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
Upstream-reference: https://download.strongswan.org/security/CVE-2026-78124/strongswan-5.0.2-6.0.7_openssl_pkcs7_certs_leak.patch
---
src/libstrongswan/plugins/openssl/openssl_pkcs7.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
index b15c8d7..cefe1ae 100644
--- a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
+++ b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c
@@ -132,6 +132,10 @@ typedef struct {
METHOD(enumerator_t, cert_destroy, void,
cert_enumerator_t *this)
{
+ if (this->certs)
+ {
+ sk_X509_pop_free(this->certs, X509_free);
+ }
DESTROY_IF(this->cert);
free(this);
}
--
2.45.4

37 changes: 37 additions & 0 deletions SPECS/strongswan/CVE-2026-78126.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From a07e438a41df27bfe7a94bb11881d83a160e30b1 Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Thu, 4 Jun 2026 10:00:02 +0200
Subject: [PATCH] eap-aka: Only accept AKA-Synchronization-Failure if expected

This fixes a NULL-pointer dereference if the client sends such an error
before the server issued a challenge and allocated this->rand.

Fixes: 26e246769224 ("ported EAP-AKA branch into trunk")
Fixes: 4735965fc048 ("EAP servers check if the received EAP message was expected")
Fixes: CVE-2026-78126
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
Upstream-reference: https://download.strongswan.org/security/CVE-2026-78126/strongswan-4.4.0-6.0.7_eap_aka_sync_fail.patch
---
src/libcharon/plugins/eap_aka/eap_aka_server.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/src/libcharon/plugins/eap_aka/eap_aka_server.c b/src/libcharon/plugins/eap_aka/eap_aka_server.c
index 0712ccc..95d4b03 100644
--- a/src/libcharon/plugins/eap_aka/eap_aka_server.c
+++ b/src/libcharon/plugins/eap_aka/eap_aka_server.c
@@ -505,6 +505,12 @@ static status_t process_synchronize(private_eap_aka_server_t *this,
simaka_attribute_t type;
chunk_t data, auts = chunk_empty;

+ if (this->pending != AKA_CHALLENGE)
+ {
+ DBG1(DBG_IKE, "received %N, but not expected",
+ simaka_subtype_names, AKA_SYNCHRONIZATION_FAILURE);
+ return FAILED;
+ }
if (this->synchronized)
{
DBG1(DBG_IKE, "received %N, but peer did already resynchronize",
--
2.45.4

115 changes: 115 additions & 0 deletions SPECS/strongswan/CVE-2026-78127.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
From b002b7ca810edc05d8fe910ed270ad945943759b Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Mon, 8 Jun 2026 09:19:42 +0200
Subject: [PATCH] message: Avoid memory leak if string buffer for message is
too small

This leaked 40 or 80 bytes per parsed message for the enumerators that
were not destroyed. While triggering an OOM condition will require quite
a lot of messages and the DoS protection also helps avoiding that this
is triggered quickly, it all depends on the memory constraints of the
system and the time available to the attacker. Also, if IKEv1 is allowed,
it could get quicker as the lack of message IDs doesn't allow dismissing
unexpected messages before parsing them.

Fixes: 092958c89d52 ("fixed payload debug message")
Fixes: 6a4a47511f75 ("Show contents of the CP payload in message_t stringification")
Fixes: CVE-2026-78127
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
Upstream-reference: https://download.strongswan.org/security/CVE-2026-78127/strongswan-5.3.1-6.0.7_message_log_leak.patch
---
src/libcharon/encoding/message.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c
index 1686bae..7af13a4 100644
--- a/src/libcharon/encoding/message.c
+++ b/src/libcharon/encoding/message.c
@@ -1302,7 +1302,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
payload->get_type(payload));
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
@@ -1328,7 +1328,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
}
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
@@ -1358,7 +1358,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
eap->get_code(eap), method);
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
@@ -1399,7 +1399,8 @@ static char* get_string(private_message_t *this, char *buf, int len)
attribute->get_type(attribute));
if (written >= len || written < 0)
{
- return buf;
+ attributes->destroy(attributes);
+ goto err;
}
pos += written;
len -= written;
@@ -1411,7 +1412,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
written = snprintf(pos, len, ")");
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
@@ -1433,7 +1434,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
}
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
@@ -1448,7 +1449,7 @@ static char* get_string(private_message_t *this, char *buf, int len)
frag->get_total_fragments(frag));
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
@@ -1461,16 +1462,16 @@ static char* get_string(private_message_t *this, char *buf, int len)
written = snprintf(pos, len, "(%d)", unknown->get_type(unknown));
if (written >= len || written < 0)
{
- return buf;
+ goto err;
}
pos += written;
len -= written;
}
}
- enumerator->destroy(enumerator);
-
- /* remove last space */
snprintf(pos, len, " ]");
+
+err:
+ enumerator->destroy(enumerator);
return buf;
}
#endif
--
2.45.4

155 changes: 155 additions & 0 deletions SPECS/strongswan/CVE-2026-78129.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
From 5a9a43c975187df6ca24ecb58c3af9bdae59f542 Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Tue, 23 Jun 2026 11:55:31 +0200
Subject: [PATCH] pkcs5: Validate parsed parameters to avoid DoS attacks

With the unbounded iterations, an attacker can craft a PKCS#7 file and
send it during IKEv1 to block the processing thread practically for an
unlimited amount of time.

As the key length is used for an allocation on the stack, not limiting
it could cause a crash. We validate it after parsing the params, but
since `encryption_algorithm_from_oid()` only returns trusted key lengths
that are lower than the limit, that's fine.

The unlimited salt length had no direct impact (the maximum is bound by
the accepted message size), but we now limit it as well before cloning.

Fixes: 4076e3ee9121 ("Extract PKCS#5 handling from pkcs8 plugin to separate helper class")
Fixes: fd1ff46f6143 ("Added support for PKCS#5 v2 schemes when decrypting PKCS#8 files.")
Fixes: cab127cba66c ("Added support for encrypted PKCS#8 files (for some PKCS#5 v1.5 schemes).")
Fixes: CVE-2026-78129
Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com>
Upstream-reference: https://download.strongswan.org/security/CVE-2026-78129/strongswan-5.1.0-6.0.7_pkcs5_params_dos.patch
---
src/libstrongswan/crypto/pkcs5.c | 65 +++++++++++++++++++++++++++++++-
1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/src/libstrongswan/crypto/pkcs5.c b/src/libstrongswan/crypto/pkcs5.c
index e48a9ad..306c652 100644
--- a/src/libstrongswan/crypto/pkcs5.c
+++ b/src/libstrongswan/crypto/pkcs5.c
@@ -14,6 +14,8 @@
* for more details.
*/

+#include <inttypes.h>
+
#include "pkcs5.h"

#include <utils/debug.h>
@@ -22,6 +24,15 @@
#include <asn1/asn1_parser.h>
#include <credentials/containers/pkcs12.h>

+/** maximum accepted length for salts in parsed parameters */
+#define PKCS5_SALT_LEN_MAX 128
+
+/** maximum accepted iteration count in parsed parameters */
+#define PKCS5_ITERATIONS_MAX 1000000
+
+/** maximum key length accepted in parsed parameters */
+#define PKCS5_KEY_LEN_MAX 64
+
typedef struct private_pkcs5_t private_pkcs5_t;

/**
@@ -374,6 +385,41 @@ METHOD(pkcs5_t, decrypt, bool,
keymat, key, iv);
}

+/**
+ * Make sure the salt has an appropriate length
+ */
+static bool validate_salt_length(chunk_t salt)
+{
+ if (salt.len > PKCS5_SALT_LEN_MAX)
+ {
+ DBG1(DBG_ASN, " salt length %zu exceeds maximum of %zu bytes",
+ salt.len, (size_t)PKCS5_SALT_LEN_MAX);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * Validate that parsed parameters are in an allowed range
+ */
+static bool validate_params(private_pkcs5_t *this)
+{
+ if (!this->iterations || this->iterations > PKCS5_ITERATIONS_MAX)
+ {
+ DBG1(DBG_ASN, " iteration count %" PRIu64 " is out of range "
+ "(1-%" PRIu64 ")", this->iterations,
+ (uint64_t)PKCS5_ITERATIONS_MAX);
+ return FALSE;
+ }
+ if (this->keylen > PKCS5_KEY_LEN_MAX)
+ {
+ DBG1(DBG_ASN, " key length %zu exceeds maximum of %zu bytes",
+ this->keylen, (size_t)PKCS5_KEY_LEN_MAX);
+ return FALSE;
+ }
+ return TRUE;
+}
+
/**
* ASN.1 definition of a PBEParameter structure
*/
@@ -394,7 +440,7 @@ static bool parse_pbes1_params(private_pkcs5_t *this, chunk_t blob, int level0)
asn1_parser_t *parser;
chunk_t object;
int objectID;
- bool success;
+ bool success = FALSE;

parser = asn1_parser_create(pbeParameterObjects, blob);
parser->set_top_level(parser, level0);
@@ -405,6 +451,10 @@ static bool parse_pbes1_params(private_pkcs5_t *this, chunk_t blob, int level0)
{
case PBEPARAM_SALT:
{
+ if (!validate_salt_length(object))
+ {
+ goto end;
+ }
this->salt = chunk_clone(object);
break;
}
@@ -416,6 +466,11 @@ static bool parse_pbes1_params(private_pkcs5_t *this, chunk_t blob, int level0)
}
}
success = parser->success(parser);
+ if (success)
+ {
+ success = validate_params(this);
+ }
+end:
parser->destroy(parser);
return success;
}
@@ -466,6 +521,10 @@ static bool parse_pbkdf2_params(private_pkcs5_t *this, chunk_t blob, int level0)
{
case PBKDF2_SALT:
{
+ if (!validate_salt_length(object))
+ {
+ goto end;
+ }
this->salt = chunk_clone(object);
break;
}
@@ -495,6 +554,10 @@ static bool parse_pbkdf2_params(private_pkcs5_t *this, chunk_t blob, int level0)
}
}
success = parser->success(parser);
+ if (success)
+ {
+ success = validate_params(this);
+ }
end:
parser->destroy(parser);
return success;
--
2.45.4

Loading
Loading