]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
2 days agocharon-cmd: Make local host configurable master
Tobias Brunner [Mon, 1 Jun 2026 07:02:35 +0000 (09:02 +0200)] 
charon-cmd: Make local host configurable

This allows preferring a particular address family (via 0.0.0.0 or ::)
or even a specific local address.

2 days agocharon-cmd: Use %any as local address so IPv4 is not preferred
Tobias Brunner [Mon, 1 Jun 2026 06:54:49 +0000 (08:54 +0200)] 
charon-cmd: Use %any as local address so IPv4 is not preferred

When resolving the remote host, we first determine if a particular
address family is preferred locally.  With `0.0.0.0` that's IPv4, with
`%any` that's not the case.  So we use the latter to allow resolvers
to return an IPv6 address.

5 days agooss-fuzz: Add new fuzzer targeting libtls
Arthur Chan [Wed, 11 Feb 2026 09:57:43 +0000 (09:57 +0000)] 
oss-fuzz: Add new fuzzer targeting libtls

Closes strongswan/strongswan#3004

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
6 days agoswanctl: Add option to only list a specific connection with --list-conns
Tobias Brunner [Thu, 28 May 2026 14:44:54 +0000 (16:44 +0200)] 
swanctl: Add option to only list a specific connection with --list-conns

6 days agoMerge branch 'vici-proposals'
Tobias Brunner [Thu, 28 May 2026 14:27:37 +0000 (16:27 +0200)] 
Merge branch 'vici-proposals'

Adds IKE and IPsec proposals to the `list-conn` VICI event.  Currently
not printed in `swanctl --list-conns` to keep the output compact (`--raw`
can be used to see the proposals).

Closes strongswan/strongswan#3067

6 days agovici: Return proposals in a more structured way
Tobias Brunner [Wed, 27 May 2026 06:27:15 +0000 (08:27 +0200)] 
vici: Return proposals in a more structured way

This allows clients to distinguish between algorithms of different
transform types more easily.  The names are similar to those used
when returning the algorithms of the selected proposal in list-sas (except
for `ke` instead of `dh` and `sn` instead of `esn` to reflect the
latest IETF/IANA changes).

6 days agovici: Include proposals in connection listings
Mathijs Smit [Wed, 20 May 2026 11:45:55 +0000 (13:45 +0200)] 
vici: Include proposals in connection listings

Signed-off-by: Mathijs Smit <smit.mathijs@gmail.com>
6 days agoike-cfg: Add flag to suppress log message when retrieving proposals
Tobias Brunner [Thu, 21 May 2026 15:16:09 +0000 (17:16 +0200)] 
ike-cfg: Add flag to suppress log message when retrieving proposals

6 days agochild-cfg: Add flag to suppress log message when retrieving proposals
Tobias Brunner [Thu, 21 May 2026 15:14:31 +0000 (17:14 +0200)] 
child-cfg: Add flag to suppress log message when retrieving proposals

6 days agooid: Fix confusing identifiers for elliptic curves over prime fields devel
Tobias Brunner [Thu, 28 May 2026 11:30:07 +0000 (13:30 +0200)] 
oid: Fix confusing identifiers for elliptic curves over prime fields

SECT (indicating a binary field) was incorrectly used in constants for
the SECP (prime field) curves.

6 days agopublic-key: Fix mapping of RSA with PKCS#1 v1.5 and SHA3-512 to OID
Tobias Brunner [Thu, 28 May 2026 11:21:22 +0000 (13:21 +0200)] 
public-key: Fix mapping of RSA with PKCS#1 v1.5 and SHA3-512 to OID

Fixes: 40f2589abfc8 ("gmp: Support of SHA-3 RSA signatures")
6 days agoconfigure: Fix check for option that indicates if plugins are packaged separately
Tobias Brunner [Thu, 28 May 2026 10:14:39 +0000 (12:14 +0200)] 
configure: Fix check for option that indicates if plugins are packaged separately

The option was renamed with 7f9f9bd375ab ("Fixed some typos, courtesy of
codespell"), the check was not.

Fixes: dd7b0283efcd ("plugin-loader: Add option to change log message if plugin is not found")
6 days agogithub: Fix typo when enabling curve25519 plugin for gcrypt tests
Tobias Brunner [Thu, 28 May 2026 10:17:45 +0000 (12:17 +0200)] 
github: Fix typo when enabling curve25519 plugin for gcrypt tests

Doesn't make a difference as the configure script also accepts the option
with a single dash.

7 days agogithub: Move permissions to the individual jobs
Tobias Brunner [Wed, 27 May 2026 11:31:51 +0000 (13:31 +0200)] 
github: Move permissions to the individual jobs

SonarQube complains about workflow-level "allow" permissions.

7 days agogithub: Increase the time CIFuzz is running the fuzzers
Tobias Brunner [Wed, 27 May 2026 10:38:27 +0000 (12:38 +0200)] 
github: Increase the time CIFuzz is running the fuzzers

Several new fuzzers were added since this workflow was created (in
particular due to the plugin split).

7 days agofuzz: Add fuzzer targeting RADIUS messages
Arthur Chan [Wed, 11 Mar 2026 22:21:16 +0000 (22:21 +0000)] 
fuzz: Add fuzzer targeting RADIUS messages

Closes strongswan/strongswan#3027

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
7 days agofuzz: Add fuzzer targeting VICI messages
Arthur Chan [Wed, 11 Mar 2026 21:54:45 +0000 (21:54 +0000)] 
fuzz: Add fuzzer targeting VICI messages

Closes strongswan/strongswan#3026

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
12 days agogithub: Add a note regarding vulnerability reports to issue template
Tobias Brunner [Thu, 21 May 2026 08:12:14 +0000 (10:12 +0200)] 
github: Add a note regarding vulnerability reports to issue template

Also updated the version numbers in the template.

12 days agoike-init: Fix key derivation if SA is reset after IKE_INTERMEDIATE retransmits
Tobias Brunner [Wed, 20 May 2026 11:49:44 +0000 (13:49 +0200)] 
ike-init: Fix key derivation if SA is reset after IKE_INTERMEDIATE retransmits

Because the `derived` flag was not reset (it's set after the initial
IKE_SA_INIT exchange), no keys would get derived when sending
IKE_INTERMEDIATE during the next try.  As there is then no `aead_t`
available, encrypting the message would fail and the initiation would
remain stuck.

Fixes: 0d49ddec2ef5 ("ike-init: Add support for multiple key exchanges")
12 days agoRevert "testing: Ignore unknown memory in leak detective"
Tobias Brunner [Wed, 20 May 2026 09:22:33 +0000 (11:22 +0200)] 
Revert "testing: Ignore unknown memory in leak detective"

This reverts commit b9986953448dc198c3c466a45e0d4f7d90c17af8.

Seems like this is not necessary anymore.  Possibly because of
8ff3238027f5 ("openssl: Prevent OpenSSL from using posix_memalign() if
LD is enabled").

12 days agocredential-manager: Check certificate expiry also for trusted self-signed certs
Thomas Jarosch [Tue, 5 May 2026 12:38:30 +0000 (14:38 +0200)] 
credential-manager: Check certificate expiry also for trusted self-signed certs

This serves as a defense-in-depth measure against forgotten
configs/credentials.

12 days agocredential-manager: Check expiry also for last cert in incomplete trust chain
Thomas Jarosch [Tue, 5 May 2026 13:41:01 +0000 (15:41 +0200)] 
credential-manager: Check expiry also for last cert in incomplete trust chain

While the validity of a pre-trusted certificate for which an issuer is
found is enforced via `check_certificate()`, the validity of such a
certificate in an incomplete trust chain, or rather that of the last
certificate in such a chain, was not enforced.  This fixes that
inconsistency.

12 days agounit-tests: Replace expired self-signed TLS certificates
Tobias Brunner [Tue, 19 May 2026 14:49:22 +0000 (16:49 +0200)] 
unit-tests: Replace expired self-signed TLS certificates

2 weeks agoswid-gen: Use process_t to avoid potential command injection
Tobias Brunner [Mon, 18 May 2026 12:19:35 +0000 (14:19 +0200)] 
swid-gen: Use process_t to avoid potential command injection

In a targeted request, the software ID is provided by the IMV.  If no
database is used (which is not the recommended setup), the ID is not
validated and could potentially contain special characters.  With the
previous command string construction and use of popen(), which runs a
shell, that could potentially allow running arbitrary commands.

2 weeks agoike-init: Destroy KE object after each derivation during initial exchanges
Tobias Brunner [Mon, 18 May 2026 14:29:41 +0000 (16:29 +0200)] 
ike-init: Destroy KE object after each derivation during initial exchanges

This fixes error handling in build_r_multi_ke() so we don't incorrectly
reuse the object from the previous exchange if we don't receive a KE
payload.

2 weeks agochild-rekey: Avoid potential use-after-free for deleted SPIs array
Tobias Brunner [Mon, 18 May 2026 13:47:46 +0000 (15:47 +0200)] 
child-rekey: Avoid potential use-after-free for deleted SPIs array

2 weeks agotun-device: Fix setting IPv6 address on Linux
Tobias Brunner [Mon, 18 May 2026 13:41:04 +0000 (15:41 +0200)] 
tun-device: Fix setting IPv6 address on Linux

Unlike `struct ifreq` that's used for IPv4, `struct in6_ifreq` contains
not a `struct sockaddr[_in6]` but only a `struct in6_addr`.

Setting addresses like this is currently not used on Linux (the feature
was added to install virtual IPs on FreeBSD/macOS).

Fixes: fccc76449dc5 ("tun-device: Fix handling of IPv6 addresses")
2 weeks agoswanctl: Make sure options array passed to getopt_long() ends with a NULL entry
Tobias Brunner [Mon, 18 May 2026 13:20:27 +0000 (15:20 +0200)] 
swanctl: Make sure options array passed to getopt_long() ends with a NULL entry

2 weeks agopki: Make sure options array passed to getopt_long() ends with a NULL entry
Tobias Brunner [Mon, 18 May 2026 13:18:08 +0000 (15:18 +0200)] 
pki: Make sure options array passed to getopt_long() ends with a NULL entry

2 weeks agopts: Fix error string if mandatory DH group is unavailable
Tobias Brunner [Mon, 18 May 2026 13:02:08 +0000 (15:02 +0200)] 
pts: Fix error string if mandatory DH group is unavailable

Fixes: 0841280cdde8 ("libimcv: Fix build with DEBUG_LEVEL < 3")
2 weeks agoxof: Fix mapping for SHA3-512 to a corresponding MGF1 identifier
Tobias Brunner [Mon, 18 May 2026 12:54:54 +0000 (14:54 +0200)] 
xof: Fix mapping for SHA3-512 to a corresponding MGF1 identifier

Fixes: 3b7c49bc3138 ("mgf1: Support of RSA PSS with SHA3 hash")
2 weeks agoopenssl: Check that EC keys don't have explicit params for internally loaded keys
Tobias Brunner [Mon, 18 May 2026 12:45:38 +0000 (14:45 +0200)] 
openssl: Check that EC keys don't have explicit params for internally loaded keys

Keys loaded via generic loader (KEY_ANY) or from a PKCS#12 file (or an
engine) don't go through the openssl_ec_private_key_load() constructor
that checks for explicit parameters.

2 weeks agobotan: Fix registration of ECDSA signature/verification plugin features
Tobias Brunner [Wed, 13 May 2026 14:03:31 +0000 (16:03 +0200)] 
botan: Fix registration of ECDSA signature/verification plugin features

This was broken since the Botan 3 release, which removed the EMSA1
class and the define.  The "EMSA1()" wrapper when signing/verifying is
technically not necessary anymore since then (it's deprecated but still
accepted).  But to still support Botan 2, we keep that in for now.

2 weeks agogithub: Use AWS-LC 1.73.0 for tests
Tobias Brunner [Tue, 12 May 2026 15:44:40 +0000 (17:44 +0200)] 
github: Use AWS-LC 1.73.0 for tests

2 weeks agoreceiver: Avoid unaligned memory access in COOKIE verification
Tobias Brunner [Tue, 12 May 2026 14:59:16 +0000 (16:59 +0200)] 
receiver: Avoid unaligned memory access in COOKIE verification

This access could be an issue on platforms with strict alignment
requirements.

2 weeks agodhcp: Fix potential OOB read when parsing DHCP messages
Tobias Brunner [Mon, 11 May 2026 08:40:36 +0000 (10:40 +0200)] 
dhcp: Fix potential OOB read when parsing DHCP messages

The missing parentheses around the additions when calculating optlen
in the previous code can cause an out-of-bound read of up to 228 bytes
if no DHCP_OPTEND is found in the message (the calculation basically
evaluated to `- 20 + 8 + 240`).

Since the buffer for the received packet (via pf_handler_t) is located
on the stack, this shouldn't cause much of an issue in practice.

2 weeks agogithub: Evict old entries from ccache
Tobias Brunner [Tue, 19 May 2026 09:29:27 +0000 (11:29 +0200)] 
github: Evict old entries from ccache

We don't want to build old versions using these caches, so we don't
need old entries (if header files change, there could be lots of
differences that increase the cache size unnecessarily).

3 weeks agogithub: Use separate caches for custom-built dependencies
Tobias Brunner [Tue, 12 May 2026 08:46:29 +0000 (10:46 +0200)] 
github: Use separate caches for custom-built dependencies

These are shared by many tests, in particular the "all", "coverage",
"no-dbg" and "no-testable-ke" tests, which each would otherwise require
their own large cache.

Similarly, the "codeql" and "sonarcloud" tests rely on the same
dependencies but only the latter uses ccache for the strongSwan build.

Also reduce the maximum size per cache for all workflows to keep them
in check over time (some could even be set lower, we'll have to see
how this develops).

3 weeks agogithub: Remove most builds with leak detective
Tobias Brunner [Mon, 11 May 2026 16:20:04 +0000 (18:20 +0200)] 
github: Remove most builds with leak detective

As mentioned in the previous commit, ASAN does a fine job detecting leaks
during the tests.  We just add a single LD-enabled build of the "default"
test here to test the basic functionality.
And we continue to use leak detective in our testing environment to keep
the memory requirements low.

We don't need a separate cache for the "apidoc" test and while the
"dist" test is similar as well, it builds in a different directory,
which means that config.h causes a cache miss for everything but the
configure checks.

3 weeks agogithub: Always build OpenSSL with SRP support
Tobias Brunner [Mon, 11 May 2026 12:53:10 +0000 (14:53 +0200)] 
github: Always build OpenSSL with SRP support

The special handling caused a significant diff between builds with and
without LD, which made ccache less effective as we only store the cache
once for the build without LD.

However, despite this change, while it previously was the case that the
LD vs. non-LD builds didn't differ much, that's not the case anymore
nowadays.  In particular the --disable-asan option and the BFD-based
backtraces for the native OpenSSL builds (e.g. default or openssl-sys)
cause quite a significant diff.  As cache storage is limited, we keep
the current behavior for now.  But it might be an option to reduce or
even remove the LD builds in the future as ASAN seems do the job pretty
well and we still use LD in the testing environment.

3 weeks agogithub: Only store a cache for large custom-built crypto libs
Tobias Brunner [Mon, 11 May 2026 09:27:44 +0000 (11:27 +0200)] 
github: Only store a cache for large custom-built crypto libs

The others are either included already in the "all" build (to which we
now switch) or they have a relatively small diff to that (e.g. gcrypt
only differs in that relatively small plugin).  For the "openssl-sys"
build, we can rely on the "default" build but only on ubuntu-latest as
we don't build that on ubuntu-22.04.

3 weeks agogithub: Disable TRAP caching for CodeQL workflow
Tobias Brunner [Fri, 8 May 2026 13:48:06 +0000 (15:48 +0200)] 
github: Disable TRAP caching for CodeQL workflow

This creates a cache entry of ~590 MB whenever master is built.  Not sure
if it actually provides any speed up.

3 weeks agogithub: Fix ref in cache cleanup workflow
Tobias Brunner [Fri, 8 May 2026 13:30:13 +0000 (15:30 +0200)] 
github: Fix ref in cache cleanup workflow

3 weeks agogithub: Add workflow to remove cache entries once a branch is deleted
Tobias Brunner [Fri, 8 May 2026 12:45:25 +0000 (14:45 +0200)] 
github: Add workflow to remove cache entries once a branch is deleted

3 weeks agogithub: Only store (and delete) caches for branches not PRs
Tobias Brunner [Fri, 8 May 2026 12:42:30 +0000 (14:42 +0200)] 
github: Only store (and delete) caches for branches not PRs

3 weeks agoUse Botan 3.12.0 for tests
Tobias Brunner [Fri, 8 May 2026 09:59:02 +0000 (11:59 +0200)] 
Use Botan 3.12.0 for tests

3 weeks agogithub: Simplify the CodeQL workflow
Tobias Brunner [Thu, 7 May 2026 16:01:34 +0000 (18:01 +0200)] 
github: Simplify the CodeQL workflow

It doesn't look like ccache will be supported anytime soon.  So just
remove all that unnecessary boilerplate.

3 weeks agogithub: Don't restore just any cache for the Linux tests
Tobias Brunner [Thu, 7 May 2026 15:55:18 +0000 (17:55 +0200)] 
github: Don't restore just any cache for the Linux tests

If e.g. an "all" cache is restored for a "default", "apidoc" or a simple
crypto test, the cache will be a lot larger than necessary.

3 weeks agogithub: Let diff report if the active transforms are identical
Tobias Brunner [Thu, 7 May 2026 09:22:55 +0000 (11:22 +0200)] 
github: Let diff report if the active transforms are identical

Since the check is skipped if no reference file is found, this makes it
clear that files were actually compared.

3 weeks agogithub: Remove commit ID from cache keys and manually evict old entries
Tobias Brunner [Fri, 17 Apr 2026 13:18:11 +0000 (15:18 +0200)] 
github: Remove commit ID from cache keys and manually evict old entries

Let's try this again :)  Since cache entries with the same key are not
updated/replaced and there is no option to do so, we manually delete the
previous entry for the current branch.

This reduces the cache storage for active branches, which can cause
caches of the master branch to get evicted, which in turn will slow down
builds of not only master but also new branches as they can't fall back
on those caches.

Permission has to be explicitly granted in order to delete the cache
entries when not using the legacy all-write tokens that are the default
for old repositories.

The continue-on-error option is set for the step that deletes the old
cache entry as it's expected that cache-hit will be true for a new feature
branch when restoring the cache from the master branch.  However, because
there won't be anything to delete for this branch yet, the command will
fail.  The --succeed-on-no-caches option of the command unfortunately
only works with --all.

For the Linux tests, several jobs use the same cache key.  So there is
a chance that two jobs try to store a new entry concurrently, which will
fail (it works if there was a cache hit and they are slightly off as
previous entries are first deleted).  To avoid that, we store the cache
only for one particular config.

Also made sure that the "openssl" test does not remove "openssl-3/4"
caches by adding a suffix to the former.

For alpine, the repository had to be set explicitly as gh wasn't able to
determine it (didn't detect the Git working dir).

4 weeks agogithub: Disable fail-fast strategy instead of using continue-on-error
Tobias Brunner [Wed, 6 May 2026 14:11:00 +0000 (16:11 +0200)] 
github: Disable fail-fast strategy instead of using continue-on-error

While continue-on-error can be configured more specifically (e.g. also
would allow to handle "default" and "printf-builtin" tests that rely
on debug symbols), it also lets the workflow succeed if any of these
jobs fail.  That's not ideal if there is an actual error and not
just an intermittent package sync problem.

4 weeks agogithub: Add build against OpenSSL 4.0.0
Tobias Brunner [Mon, 4 May 2026 13:12:05 +0000 (15:12 +0200)] 
github: Add build against OpenSSL 4.0.0

4 weeks agoopenssl: Prevent OpenSSL from using posix_memalign() if LD is enabled
Tobias Brunner [Mon, 4 May 2026 13:06:49 +0000 (15:06 +0200)] 
openssl: Prevent OpenSSL from using posix_memalign() if LD is enabled

The leak detective doesn't wrap this function and calling the original
causes unknown memory frees and even segmentation faults.  This is now
triggered with OpenSSL 4 as the implementation of ECP256 uses
OPENSSL_aligned_alloc_array().

Setting a custom memory functions forces OpenSSL to implement aligned
allocations internally, using the registered allocation function.

4 weeks agoopenssl: Fix 'const' issues that came up with OpenSSL 4
Tobias Brunner [Mon, 4 May 2026 10:11:47 +0000 (12:11 +0200)] 
openssl: Fix 'const' issues that came up with OpenSSL 4

4 weeks agoopenssl: Use functions for ASN.1 struct members hidden in OpenSSL 4
Tobias Brunner [Mon, 4 May 2026 10:04:53 +0000 (12:04 +0200)] 
openssl: Use functions for ASN.1 struct members hidden in OpenSSL 4

According to the docs, most ASN.1 types are just typedefs of ASN1_STRING.

4 weeks agoopenssl: Use openssl_i2chunk when creating ASN.1 chunks
Thomas Egerer [Wed, 5 Nov 2025 10:18:48 +0000 (10:18 +0000)] 
openssl: Use openssl_i2chunk when creating ASN.1 chunks

Using the return value of i2d_* directly as input of chunk_alloc imposes
the risk of creating an invalid chunk when the return value of the i2d_*
function is -1. The openssl_i2chunk macro is meant to avoid this.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
5 weeks agokernel-pfkey: Add some sanity checks when processing kernel events
Tobias Brunner [Thu, 23 Apr 2026 13:12:12 +0000 (15:12 +0200)] 
kernel-pfkey: Add some sanity checks when processing kernel events

These are always set in kernel messages, but just make sure so static
analyzers like SonarQube are happy.

5 weeks agoconstant-time: Fix Doxygen group assignment
Tobias Brunner [Thu, 23 Apr 2026 09:46:52 +0000 (11:46 +0200)] 
constant-time: Fix Doxygen group assignment

6 weeks agoopenssl: Fix memory leak if ipAddrBlock is non-canonical
Tobias Brunner [Wed, 22 Apr 2026 07:44:38 +0000 (09:44 +0200)] 
openssl: Fix memory leak if ipAddrBlock is non-canonical

6 weeks agonm: Version bump to 1.6.5
Tobias Brunner [Wed, 22 Apr 2026 12:01:52 +0000 (14:01 +0200)] 
nm: Version bump to 1.6.5

6 weeks agoVersion bump to 6.0.6 6.0.6
Andreas Steffen [Wed, 22 Apr 2026 05:55:01 +0000 (07:55 +0200)] 
Version bump to 6.0.6

6 weeks agoNEWS: Add news for 6.0.6 and info about CVEs (CVE-2026-35328..35334)
Tobias Brunner [Thu, 16 Apr 2026 16:34:24 +0000 (18:34 +0200)] 
NEWS: Add news for 6.0.6 and info about CVEs (CVE-2026-35328..35334)

6 weeks agogmp: Avoid crash and timing leaks in PKCS#1 v1.5 decryption padding validation
Tobias Brunner [Tue, 24 Mar 2026 17:05:01 +0000 (18:05 +0100)] 
gmp: Avoid crash and timing leaks in PKCS#1 v1.5 decryption padding validation

This fixes a potential crash due to a null-pointer dereference if rsadp()
returns NULL (e.g. with an all-zero ciphertext).

And it also implements the PKCS#1 v1.5 decryption padding check in
constant time.

The timing leak caused by the previous implementation was measured at
~17.5 μs at 3 GHz, which could allow a Bleichenbacher-like attack in
LAN environments.  However, because of how RSA encryption is used in
strongSwan, this is not that much of an issue in practice.  The mechanism
is only used for two use cases.  One is SCEP/EST via PKCS#7 enveloped
data.  Fortunately, this can not be triggered in significant numbers by
an attacker.  The other use case is TLS as used by EAP methods (EAP-TLS,
EAP-PEAP/TTLS) during the authentication.  While the cipher suites that
use RSA encryption are still enabled by default, the TLS messages are
wrapped in EAP and encrypted by IKE, making any kind of attack difficult.

Note that the gmp plugin isn't enabled anymore by default.  And even
before that, most setups had the openssl plugin enabled, which has
priority over the gmp plugin.  So it's unlikely the plugin was used in
practice.

Fixes: d615ffdcf3cd ("implement gmp_rsa_private_key.decrypt()")
Fixes: CVE-2026-35334
6 weeks agoutils: Add constant-time comparison primitives for uint32_t
Tobias Brunner [Tue, 24 Mar 2026 17:00:23 +0000 (18:00 +0100)] 
utils: Add constant-time comparison primitives for uint32_t

6 weeks agopkcs7: Avoid NULL pointer dereference when verifying padding in enveloped content
Tobias Brunner [Wed, 25 Mar 2026 09:35:03 +0000 (10:35 +0100)] 
pkcs7: Avoid NULL pointer dereference when verifying padding in enveloped content

As the previous issue, this can be triggered via IKEv1 CERT payloads.

Fixes: d7aa09104f08 ("Implement PKCS#7 enveloped-data parsing and decryption")
Fixes: CVE-2026-35329
6 weeks agopkcs5: Fail decryption if data is empty
Tobias Brunner [Wed, 25 Mar 2026 09:32:36 +0000 (10:32 +0100)] 
pkcs5: Fail decryption if data is empty

This avoids the previous bug early.

6 weeks agopkcs5: Avoid NULL pointer dereference when verifying padding
Tobias Brunner [Wed, 25 Mar 2026 09:28:45 +0000 (10:28 +0100)] 
pkcs5: Avoid NULL pointer dereference when verifying padding

Can be triggered via empty PKCS#7 encrypted content in IKEv1 CERT payload.

Fixes: 4076e3ee9121 ("Extract PKCS#5 handling from pkcs8 plugin to separate helper class")
Fixes: CVE-2026-35329
6 weeks agotls-server: Prevent infinite loop if supported versions are too short
Tobias Brunner [Wed, 25 Mar 2026 09:17:46 +0000 (10:17 +0100)] 
tls-server: Prevent infinite loop if supported versions are too short

If the extension doesn't contain a multiple of two bytes, the previous
code would get stuck in an infinite loop as `remaining()` continued to
return TRUE while `read_uint16()` failed to parse a value. Initiating
several connections with such an extension allows a DoS attack as no
threads would eventually be available to handle packets/events.

Fixes: 7fbe2e27ecf6 ("tls-server: TLS 1.3 support for TLS server implementation")
Fixes: CVE-2026-35328
6 weeks agoconstraints: Reject excluded directoryName (DN) name constraints
Tobias Brunner [Mon, 23 Mar 2026 17:02:19 +0000 (18:02 +0100)] 
constraints: Reject excluded directoryName (DN) name constraints

There is an issue similar to the one fixed with the previous commit when
using directoryName (DN) name constraints.  Some RDNs have to be matched
in a case-insensitive manner, which we e.g. do in
`identification.c::rdn_equals`.  By not doing it for name constraints,
a malicious intermediate CA could evade an excluded name constraint
just by modifying the case in such an RDN.

While we could use the mentioned function in `dn_matches`, this doesn't
properly fix the problem because the function is basically too strict.
Especially in regards to RDNs of type UTF8String, which are only compared
binary.  To match these properly, we'd have to implement the string
preparation described in RFC 5280, section 7.1 and the referenced RFCs.
Until that's the case, we reject excluded name constraints of type
directoryName as we are unable to enforce them.

Fixes: a2b340764fac ("Implemented NameConstraint matching in constraints plugin")
Fixes: CVE-2026-35331
6 weeks agoconstraints: Match FQDN and email addresses case-insensitively
Tobias Brunner [Mon, 23 Mar 2026 16:45:11 +0000 (17:45 +0100)] 
constraints: Match FQDN and email addresses case-insensitively

The case is generally ignored when matching such identities.  So this is
an issue with excluded name constraints where a malicious intermediate
CA could evade the constraints by issuing certificates with names that
just modify the case (e.g. strongSwan.org instead strongswan.org).

Note that it's likely that permitted name constraints are preferred over
excluded name constraints as it might be difficult to come up with a
conclusive list of names to exclude.

Fixes: a2b340764fac ("Implemented NameConstraint matching in constraints plugin")
Fixes: CVE-2026-35331
6 weeks agotls-server: Only accept non-empty ECDH public keys with TLS < 1.3
Tobias Brunner [Fri, 20 Mar 2026 16:38:07 +0000 (17:38 +0100)] 
tls-server: Only accept non-empty ECDH public keys with TLS < 1.3

This prevents a crash due to a null-pointer dereference when processing
an empty ECDH public key.

The previous length check only applied in the `!ec` case, so in the `ec`
case, the access to `pub.ptr[0]` was unguarded.  If a crafted TLS
record ends with an empty ClientKeyExchange, then `read_data8` sets
`pub` to `chunk_empty`, causing a null-pointer dereference.

Note that if some data follows the empty ClientKeyExchange, this just
causes a 1-byte out-of-bounds read that has no further effect as the
TLS session is aborted immediately.  Either because the read value
doesn't equal TLS_ANSI_UNCOMPRESSED or because the empty public key
is rejected by `set_public_key()`.

The referenced commit that introduced the pointer access, added the
check for `pub.len` specifically to the `!ec` case, while the pointer
access was initially unconditional (probably because the code was just
copied from `tls_peer.c` which processes ECDH public keys in a separate
function, so there was no `ec` flag).  The latter was fixed a couple of
days later with 7b3c01845f63 ("Read the compression type byte for EC
groups, only").  However, that commit didn't change the length check.
Anyway, it's possible that the original intention was to add the check
to the `ec` case on the previous line, or that there was some confusion
with the parenthesis and something like the current code was intended to
begin with.

Fixes: e6cce7ff0d1b ("Prepend point format to ECDH public key")
Fixes: CVE-2026-35332
6 weeks agolibradius: Reject undersized attributes in enumerator
Lukas Johannes Möller [Thu, 12 Mar 2026 10:24:45 +0000 (10:24 +0000)] 
libradius: Reject undersized attributes in enumerator

attribute_enumerate() accepts RADIUS attributes whose length byte is
smaller than sizeof(rattr_t) (2).  For length == 0, the iterator never
advances and traps callers — including verify() — in a non-advancing
loop.  For length == 1, misaligned packed-struct reads occur.

Add a separate check for this->next->length < sizeof(rattr_t) after
the existing truncation guard.  This mirrors radius_message_parse(),
which already distinguishes invalid length from truncation.

Signed-off-by: Lukas Johannes Möller <research@johannes-moeller.dev>
Fixes: 4a6b84a93461 ("reintegrated eap-radius branch into trunk")
Fixes: CVE-2026-35333
6 weeks agolibsimaka: Reject zero-length EAP-SIM/AKA attributes
Lukas Johannes Möller [Wed, 11 Mar 2026 16:07:10 +0000 (16:07 +0000)] 
libsimaka: Reject zero-length EAP-SIM/AKA attributes

parse_attributes() accepts hdr->length == 0 in the AT_ENCR_DATA,
AT_RAND, AT_PADDING, default branches. The code then subtracts the
fixed attribute header size from the encoded length, which underflows
and exposes a wrapped payload length to later code.  In particular,
for the cases where add_attribute() is called, this causes a heap-based
buffer overflow (a buffer of 12 bytes is allocated to which the wrapped
length is written).  For AT_PADDING, the underflow is irrelevant as
add_attribute() is not called. Instead, this results in an infinite loop.

Reject zero-length attributes before subtracting the attribute header.

Signed-off-by: Lukas Johannes Möller <research@johannes-moeller.dev>
Fixes: f8330d03953b ("Added a libsimaka library with shared message handling code for EAP-SIM/AKA")
Fixes: CVE-2026-35330
6 weeks agogithub: Move CI for Windows from AppVeyor to GitHub Actions
Tobias Brunner [Tue, 21 Apr 2026 07:56:18 +0000 (09:56 +0200)] 
github: Move CI for Windows from AppVeyor to GitHub Actions

These are quite a bit faster than on AppVeyor (with ccache about a fifth,
without less than half - and they run concurrently).

We only keep the AppVeyor builds for now to test against those old
OpenSSL versions (1.1.1 and 1.0.2) for which there is still extended
support available.  Even simplified like that they still take longer
than the builds on GA.

6 weeks agoRevert "github: Remove commit ID from cache keys"
Tobias Brunner [Tue, 21 Apr 2026 09:03:09 +0000 (11:03 +0200)] 
Revert "github: Remove commit ID from cache keys"

Without commit ID, no new caches are created as the key is always the
same.

This reverts commit 60f4c867809a6280c71e5b62f69cbed75839fa93.

6 weeks agogithub: Remove commit ID from cache keys
Tobias Brunner [Fri, 17 Apr 2026 13:18:11 +0000 (15:18 +0200)] 
github: Remove commit ID from cache keys

This reduces the cache storage for active branches and since caches for
different branches are separate and we abort previous builds of the same
branch, this is not necessary to ensure caches can successfully be stored.

6 weeks agocirrus/github: Move CI for Alpine from Cirrus CI to GitHub Actions
Tobias Brunner [Fri, 17 Apr 2026 08:51:28 +0000 (10:51 +0200)] 
cirrus/github: Move CI for Alpine from Cirrus CI to GitHub Actions

Same as the previous commit.

6 weeks agocirrus/github: Move CI for FreeBSD from Cirrus CI to GitHub Actions
Tobias Brunner [Fri, 17 Apr 2026 08:27:48 +0000 (10:27 +0200)] 
cirrus/github: Move CI for FreeBSD from Cirrus CI to GitHub Actions

Cirrus CI will shut down in June, so we have to find a replacement to
test our build on FreeBSD.  This uses VMs on GitHub Actions.

6 weeks agokernel-netlink: Update family in SA selector if addresses change
Tobias Brunner [Wed, 18 Mar 2026 12:00:18 +0000 (13:00 +0100)] 
kernel-netlink: Update family in SA selector if addresses change

6 weeks agoike: Use correct format string for unique Child SA identifiers
Tobias Brunner [Thu, 16 Apr 2026 13:25:07 +0000 (15:25 +0200)] 
ike: Use correct format string for unique Child SA identifiers

Analogous to the previous commit.

6 weeks agoike: Use correct format string for unique IKE SA identifiers
Tobias Brunner [Thu, 16 Apr 2026 13:13:52 +0000 (15:13 +0200)] 
ike: Use correct format string for unique IKE SA identifiers

Would take a while until it became an issue, though.

6 weeks agodelete-ike-sa-job: Log unique ID when deleting half-open IKE SA
Tobias Brunner [Thu, 16 Apr 2026 12:59:28 +0000 (14:59 +0200)] 
delete-ike-sa-job: Log unique ID when deleting half-open IKE SA

6 weeks agoike-init: Log the IKE SA's unique identifier when creating one as responder
Tobias Brunner [Thu, 16 Apr 2026 12:55:56 +0000 (14:55 +0200)] 
ike-init: Log the IKE SA's unique identifier when creating one as responder

The name will not be defined yet, but we have a similar message as
initiator so use the same format.

7 weeks agotesting: Fix typo regarding ML-KEM in description
Tobias Brunner [Wed, 15 Apr 2026 13:00:35 +0000 (15:00 +0200)] 
testing: Fix typo regarding ML-KEM in description

7 weeks agogithub: Use AWS-LC 1.72.0 for tests
Tobias Brunner [Tue, 14 Apr 2026 06:33:56 +0000 (08:33 +0200)] 
github: Use AWS-LC 1.72.0 for tests

7 weeks agobotan: Fix typo in algorithm string for SHA3-224 RSA verification
Markus Theil [Fri, 10 Apr 2026 19:26:27 +0000 (21:26 +0200)] 
botan: Fix typo in algorithm string for SHA3-224 RSA verification

Signed-off-by: Markus Theil <markus.theil@secunet.com>
7 weeks agotun-device: Also close IPv6 socket on destruction
Markus Theil [Fri, 10 Apr 2026 19:25:19 +0000 (21:25 +0200)] 
tun-device: Also close IPv6 socket on destruction

Signed-off-by: Markus Theil <markus.theil@secunet.com>
7 weeks agoencrypted-payload: Check for non-zero payload size
Markus Theil [Thu, 9 Apr 2026 10:17:33 +0000 (12:17 +0200)] 
encrypted-payload: Check for non-zero payload size

Signed-off-by: Markus Theil <markus.theil@secunet.com>
7 weeks agobotan: Make RNG types configurable
Markus Theil [Thu, 9 Apr 2026 17:35:50 +0000 (19:35 +0200)] 
botan: Make RNG types configurable

This allows for usage of ESDM or jitterentropy as Botan RNG without
patching strongSwan.

Signed-off-by: Markus Theil <markus.theil@secunet.com>
7 weeks agoappveyor: Reduce build time and remove build against OpenSSL 1.1.0
Tobias Brunner [Fri, 10 Apr 2026 09:21:00 +0000 (11:21 +0200)] 
appveyor: Reduce build time and remove build against OpenSSL 1.1.0

We are still too close to the limit of 1 hour (at least with the 2019
image and the 2022 image is about the same), so reduce the build time by
not building libimcv natively, which saves about 10 minutes.

Also, only build against OpenSSL 1.0.2 (on the 2017 image) and 1.1.1 (on
the 2019 image) as these are the only versions for which OpenSSL provides
extended support.

7 weeks agogithub: Continue crypto tests even if OpenSSL tests fail
Tobias Brunner [Thu, 9 Apr 2026 07:25:23 +0000 (09:25 +0200)] 
github: Continue crypto tests even if OpenSSL tests fail

These can sometimes fail because of sync issues with Ubuntu debug symbol
packages, let other crypto tests continue.

7 weeks agoUse wolfSSL 5.9.1 for tests
Tobias Brunner [Thu, 9 Apr 2026 06:53:26 +0000 (08:53 +0200)] 
Use wolfSSL 5.9.1 for tests

7 weeks agounit-tests: Use longer input for ECDSA tests
Tobias Brunner [Thu, 9 Apr 2026 07:45:27 +0000 (09:45 +0200)] 
unit-tests: Use longer input for ECDSA tests

wolfSSL 5.9.1 starts to enforce a minimum (and maximum) length for the
hash when signing.  Since we'll always require SHA-1, use 20 bytes as
input in the tests to succeed with SIGN_ECDSA_WITH_NULL.

8 weeks agofuzz: Remove unnecessary calls to set plugin dirs
Tobias Brunner [Wed, 11 Feb 2026 10:31:24 +0000 (11:31 +0100)] 
fuzz: Remove unnecessary calls to set plugin dirs

All the plugins are linked statically into the binaries, so there
is no reason to set the directories that are only required when loading
them from files.

8 weeks agofuzz: Create fuzzers with default and custom crypto plugins
Tobias Brunner [Wed, 11 Feb 2026 10:14:53 +0000 (11:14 +0100)] 
fuzz: Create fuzzers with default and custom crypto plugins

The pa_tnc fuzzer does not rely on any plugins and the pb_tnc fuzzer is
a bit special in that it does use code from the tnccs-20 plugin, but that
doesn't actually have to be loaded as such. The fuzzer directly calls
statically linked code from the plugin.

8 weeks agogithub: Update actions so they don't use deprecated Node.js 20
Tobias Brunner [Tue, 7 Apr 2026 16:57:40 +0000 (18:57 +0200)] 
github: Update actions so they don't use deprecated Node.js 20

2 months agotls-server: Avoid allocating large buffer for cipher suites on stack
Tobias Brunner [Wed, 1 Apr 2026 16:27:07 +0000 (18:27 +0200)] 
tls-server: Avoid allocating large buffer for cipher suites on stack

The `cipher_suites` field has a 16-bit length field, so up to 32k 2-byte
cipher suites could technically be proposed.  With `tls_cipher_suite_t`
typically being 4 bytes wide, the necessary allocation for the temporary
array can be up to 128 KiB.  Even though this should be fine on typical
systems, we avoid potentially overflowing the stack by using malloc()
instead of alloca().

2 months agolibipsec: Reject policies for anything but ESP tunnel mode
Tobias Brunner [Fri, 27 Mar 2026 11:35:10 +0000 (12:35 +0100)] 
libipsec: Reject policies for anything but ESP tunnel mode

This is only relevant for trap policies as similar SAs are already
rejected when negotiated.

2 months agotrap-manager: Ignore acquires without selectors for wildcard traps
Tobias Brunner [Fri, 27 Mar 2026 11:28:22 +0000 (12:28 +0100)] 
trap-manager: Ignore acquires without selectors for wildcard traps

We need to know the actual destination address to process these.

2 months agoike-init: Remove redundant check for more key exchanges during rekeying
Tobias Brunner [Fri, 27 Mar 2026 11:07:19 +0000 (12:07 +0100)] 
ike-init: Remove redundant check for more key exchanges during rekeying

We only call derive_keys() after a successful key_exchange_done() call
during rekeying, so this will always return FALSE.