Commit Graph
19816 Commits
Author SHA1 Message Date
Tobias Brunner 7faf93b701 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).
2026-05-19 17:24:22 +02:00
Tobias Brunner 3b902ea59b 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).
2026-05-12 16:34:22 +02:00
Tobias Brunner 821ba89961 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.
2026-05-12 08:37:40 +02:00
Tobias Brunner afe51f19e7 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.
2026-05-11 19:11:09 +02:00
Tobias Brunner a4b7d57c79 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.
2026-05-11 19:11:09 +02:00
Tobias Brunner 134b942494 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.
2026-05-08 15:48:06 +02:00
Tobias Brunner c85901e2f2 github: Fix ref in cache cleanup workflow 2026-05-08 15:30:13 +02:00
Tobias Brunner 9c140dd45c github: Add workflow to remove cache entries once a branch is deleted 2026-05-08 14:45:25 +02:00
Tobias Brunner daa0b109da github: Only store (and delete) caches for branches not PRs 2026-05-08 14:42:30 +02:00
Tobias Brunner 93cf3de1fc Use Botan 3.12.0 for tests 2026-05-08 12:00:15 +02:00
Tobias Brunner 77cc45dc6f github: Simplify the CodeQL workflow
It doesn't look like ccache will be supported anytime soon.  So just
remove all that unnecessary boilerplate.
2026-05-08 12:00:04 +02:00
Tobias Brunner 9854392a1f 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.
2026-05-07 18:01:30 +02:00
Tobias Brunner e4a15e5518 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.
2026-05-07 11:22:55 +02:00
Tobias Brunner 3a44941d2c 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).
2026-05-07 10:52:08 +02:00
Tobias Brunner 94443ebad1 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.
2026-05-06 17:43:46 +02:00
Tobias Brunner 4acf09644c github: Add build against OpenSSL 4.0.0 2026-05-06 10:46:43 +02:00
Tobias Brunner 8ff3238027 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.
2026-05-06 10:46:43 +02:00
Tobias Brunner 374b17fe88 openssl: Fix 'const' issues that came up with OpenSSL 4 2026-05-06 10:46:43 +02:00
Tobias Brunner 528e5f07c3 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.
2026-05-06 10:46:43 +02:00
Thomas Egerer 82c01b7060 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 <[email protected]>
2026-05-06 10:46:43 +02:00
Tobias Brunner 4821758d46 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.
2026-04-23 15:21:45 +02:00
Tobias Brunner 0a64c27a1f constant-time: Fix Doxygen group assignment 2026-04-23 11:46:52 +02:00
Tobias Brunner b4ba8a6fb5 openssl: Fix memory leak if ipAddrBlock is non-canonical 2026-04-22 14:12:12 +02:00
Tobias Brunner 9e8292cb37 nm: Version bump to 1.6.5 2026-04-22 14:01:52 +02:00
Andreas Steffen 4d709df8b2 Version bump to 6.0.6 2026-04-22 07:55:01 +02:00
Tobias Brunner 8b68b2ea51 NEWS: Add news for 6.0.6 and info about CVEs (CVE-2026-35328..35334) 2026-04-21 16:48:56 +02:00
Tobias Brunner e2fa67e8fc 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: d615ffdcf3 ("implement gmp_rsa_private_key.decrypt()")
Fixes: CVE-2026-35334
2026-04-21 16:48:56 +02:00
Tobias Brunner 90fd268088 utils: Add constant-time comparison primitives for uint32_t 2026-04-21 16:48:56 +02:00
Tobias Brunner 8dae5605a7 pkcs7: Avoid NULL pointer dereference when verifying padding in enveloped content
As the previous issue, this can be triggered via IKEv1 CERT payloads.

Fixes: d7aa09104f ("Implement PKCS#7 enveloped-data parsing and decryption")
Fixes: CVE-2026-35329
2026-04-21 16:48:56 +02:00
Tobias Brunner c6a2185c42 pkcs5: Fail decryption if data is empty
This avoids the previous bug early.
2026-04-21 16:48:56 +02:00
Tobias Brunner 4da84019cc pkcs5: Avoid NULL pointer dereference when verifying padding
Can be triggered via empty PKCS#7 encrypted content in IKEv1 CERT payload.

Fixes: 4076e3ee91 ("Extract PKCS#5 handling from pkcs8 plugin to separate helper class")
Fixes: CVE-2026-35329
2026-04-21 16:48:56 +02:00
Tobias Brunner 56c7f0d13d 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: 7fbe2e27ec ("tls-server: TLS 1.3 support for TLS server implementation")
Fixes: CVE-2026-35328
2026-04-21 16:48:56 +02:00
Tobias Brunner 64130ede5c 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: a2b340764f ("Implemented NameConstraint matching in constraints plugin")
Fixes: CVE-2026-35331
2026-04-21 16:48:56 +02:00
Tobias Brunner c66143db48 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: a2b340764f ("Implemented NameConstraint matching in constraints plugin")
Fixes: CVE-2026-35331
2026-04-21 16:48:56 +02:00
Tobias Brunner 1e0643bef1 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 7b3c01845f ("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: e6cce7ff0d ("Prepend point format to ECDH public key")
Fixes: CVE-2026-35332
2026-04-21 16:48:56 +02:00
Lukas Johannes Möller e067d24293 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 <[email protected]>

Fixes: 4a6b84a934 ("reintegrated eap-radius branch into trunk")
Fixes: CVE-2026-35333
2026-04-21 16:48:56 +02:00
Lukas Johannes Möller aa5aaebc33 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 <[email protected]>

Fixes: f8330d0395 ("Added a libsimaka library with shared message handling code for EAP-SIM/AKA")
Fixes: CVE-2026-35330
2026-04-21 16:48:56 +02:00
Tobias Brunner 19d73ef156 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.
2026-04-21 16:44:18 +02:00
Tobias Brunner e0fb06c9cc 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 60f4c86780.
2026-04-21 11:05:19 +02:00
Tobias Brunner 60f4c86780 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.
2026-04-17 15:18:11 +02:00
Tobias Brunner 1d36cae26a cirrus/github: Move CI for Alpine from Cirrus CI to GitHub Actions
Same as the previous commit.
2026-04-17 14:38:14 +02:00
Tobias Brunner 06b14b8988 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.
2026-04-17 10:36:36 +02:00
Tobias Brunner cb27593ce0 kernel-netlink: Update family in SA selector if addresses change 2026-04-16 15:33:25 +02:00
Tobias Brunner e1a11e2c1c ike: Use correct format string for unique Child SA identifiers
Analogous to the previous commit.
2026-04-16 15:32:54 +02:00
Tobias Brunner 2a8fd3e4bf ike: Use correct format string for unique IKE SA identifiers
Would take a while until it became an issue, though.
2026-04-16 15:32:54 +02:00
Tobias Brunner 5334d93a45 delete-ike-sa-job: Log unique ID when deleting half-open IKE SA 2026-04-16 15:32:54 +02:00
Tobias Brunner 7f6fc50ba3 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.
2026-04-16 15:32:54 +02:00
Tobias Brunner 1ee7e10940 testing: Fix typo regarding ML-KEM in description 2026-04-15 15:01:40 +02:00
Tobias Brunner 7862974e10 github: Use AWS-LC 1.72.0 for tests 2026-04-14 08:33:56 +02:00
Markus Theil c60a14ba23 botan: Fix typo in algorithm string for SHA3-224 RSA verification
Signed-off-by: Markus Theil <[email protected]>
2026-04-13 15:46:45 +02:00