Commit Graph
19900 Commits
Author SHA1 Message Date
Tobias Brunner 163e7bd6db tnccs_11: Fix memory leak if multiple Base64 tags are found 2026-07-23 10:26:08 +02:00
Tobias Brunner 0a9445a7c1 pt-tls-server: Fix leak if SASL authentication failed 2026-07-23 10:26:08 +02:00
Tobias Brunner dbaca2dffe pt-tls-server: Properly fail if processing PB-TNC batches failed
Because `assess()` returns a `status_t`, `FALSE` is interpreted as
`SUCCESS`. So a failure while processing PB-TNC batches terminated
the process successfully.

Fixes: 1e92d5f114 ("Process PB-TNC batches received via PT-TLS asynchronously")
2026-07-23 10:26:08 +02:00
Tobias Brunner 355d591967 openssl: Fix memory leak if HMAC instantiation fails late
Fixes: db0c53c207 ("openssl: Fixes for HMAC with OpenSSL 3.0")
2026-07-23 10:26:08 +02:00
Tobias Brunner 3a30390d91 kernel-wfp: Fix remote port in traffic selectors in acquires
Fixes: c6f189e448 ("kernel-wfp: Add support for trap policies and acquires")
2026-07-23 10:26:08 +02:00
Tobias Brunner 9598de465c unit-tests: Add tests to ensure our Curve25519/448 implementations don't return all-zero secrets
Note that wolfSSL before 5.9.2 required building with
WOLFSSL_ECDHX_SHARED_NOT_ZERO, which was added with 5.3.0, to get and
explicit check.  Since the plugin validates the public key, the test case
fails nonetheless.
2026-07-23 10:26:08 +02:00
Tobias Brunner 589a3a6729 curve25519: Reject all-zero shared secrets
While RFC 7748 states implementations MAY perform such a check, e.g.
TLS 1.3 explicitly requires it (RFC 8446, section 7.4.2).

Fixes: 7f9bfacd5a ("curve25519: Add a plugin providing Curve25519 DH using backend drivers")
2026-07-23 10:26:08 +02:00
Tobias Brunner 4436c12183 coupling: Avoid potential access by multiple threads to shared hasher
Using the same `hasher_t` instance from different threads concurrently
is not safe.  The underlying implementation might e.g. use a single
shared state for multiple API calls within `get_hash()` (e.g. the openssl
plugin does that).

Fixes: 007c47088c ("Implemented permanent certificate coupling plugin")
2026-07-23 10:26:08 +02:00
Tobias Brunner 0a53da7cd8 ita-comp-ima: Handle missing validation URI gracefully
Fixes: ab957aacce ("transport IMA file info via PTS Component Evidence Policy URI")
2026-07-23 10:26:08 +02:00
Tobias Brunner d9cf1b0bff wolfssl: Avoid potential RNG state corruption during RSA/ECDSA operations
The WC_RNG instances are potentially shared between different threads
as private key objects are refcounted.  This may corrupt their internal
state as they are not thread-safe.

For ECDSA, using separate instances for each signing operation has some
performance impact, but for signature operations that should be fine.

The implementation for RSA uses mutexes.  That's due to the weird API.
While RNG instances can be passed for signing and encryption (probably
because they are also required for padding/salt besides blinding), they
can't for verifying and decryption.  The latter use an RNG instance that
has to be set on the key object before calling these operations.  So we
could potentially split the strategy, but to keep this consistent within
the RSA implementation, just continue with the shared RNG but use a
mutex around the API calls.

Fixes: c92eade82c ("wolfssl: Add wolfSSL plugin for cryptographic implementations")
2026-07-23 10:26:07 +02:00
Tobias Brunner 05625acc2a wolfssl: Ensure X25519/X448 public key is valid 2026-07-22 18:20:12 +02:00
Tobias Brunner 1fe813f05e wolfssl: Fix memory leak on failed ICV verification if not using in-place decryption
Fixes: c92eade82c ("wolfssl: Add wolfSSL plugin for cryptographic implementations")
2026-07-22 18:20:12 +02:00
Tobias Brunner 023c626525 openssl: Fix memory leak on failed ICV verification if not using in-place decryption
Fixes: 81f9cd39fd ("openssl: Provide AES-GCM implementation")
2026-07-22 18:20:12 +02:00
Tobias Brunner c6adb20ec7 chapoly: Fix memory leak on failed ICV verification if not using in-place decryption
Fixes: 370fb3feb0 ("chapoly: Provide a generic ChaCha20/Poly1305 AEAD supporting driver backends")
2026-07-22 18:20:12 +02:00
Tobias Brunner 85c02dc16c ccm: Fix memory leak on failed ICV verification if not using in-place decryption
Fixes: 80a93a1335 ("Implemented a ccm plugin providing CCM mode based on CBC crypters")
2026-07-22 18:20:12 +02:00
Tobias Brunner 40aa0a12c4 botan: Fix memory leak on failed ICV verification if not using in-place decryption
Fixes: af26cc4d85 ("botan: Add Botan plugin to libstrongswan")
2026-07-22 18:20:12 +02:00
Tobias Brunner a2f83d3075 aesni: Fix memory leak on failed ICV verification if not using in-place decryption
The `aead_t` interface states that `decrypt()` only allocates a plaintext
buffer if successful, so callers might not free it if the call failed.

Fixes: 313811b72d ("aesni: Add a GCM AEAD based on the AES-NI key schedule")
2026-07-22 18:20:12 +02:00
Tobias Brunner dae65dd492 esp-packet: Fix leak and avoid one if AEAD implementations misbehave
If an `aead_t` implementation incorrectly allocates memory if the
decryption/ICV verification failed, this avoids a leak.  Unfortunately,
many implementations actually did that.

Fixes: 24a8d1253f ("libipsec: Wrap traditional algorithms in AEAD wrapper")
2026-07-22 18:20:12 +02:00
Tobias Brunner f5aeba0f02 watcher: Remove unnecessary pending flag
This was added with 5ce3c9b15a ("watcher: Rebuild fdset when select()
fails"), i.e. before switching to poll(), solely to suppress errors when
FDs are closed and select() would return with an error.  With poll()
this should not happen result in an error (it potentially indicates this
via POLLNVAL in revents of that FD in the array).

Because the flag was not consistently changed/read with the mutex held,
some analysis tools got confused and imagined wild deadlock scenarios.
2026-07-21 10:37:43 +02:00
Tobias Brunner 87bbfe4f5f gcm: Implement block multiplication in constant time 2026-07-21 10:37:43 +02:00
Tobias Brunner 577d4d16f6 charon-tkm: Document that public_key_t::verify() is a dummy implementation 2026-07-21 10:37:43 +02:00
Tobias Brunner bdbdd46941 medsrv: Add missing return to avoid infinite loop while verifying username 2026-07-21 10:37:43 +02:00
Tobias Brunner fcac9fe5df tls-socket: Avoid accessing stale data when processing application data
In non-blocking mode, the previous code set `in_done` to -1 (SIZE_MAX)
if `recv()` would block and nothing was read yet.  If this was followed
by a call to `write()` and `process()` is called and actually processed
application data, the length calculation in the callback underflows and
`memcpy()` would write to `in.ptr + SIZE_MAX`.  Since `read()` already
sets `errno` to `EWOULDBLOCK` and returns -1 if `in_done` is 0, the
removed check was redundant anyway.

Also, the buffer from the previous `read()` call might not be valid
anymore when `write()` is called (e.g. `splice()` uses the same buffer
for both, and the buffer could even be defined on a now invalid stack
frame of the function that called `read()` previously).  Clearing the
data avoids that and ensures the application data is cached until the
next call to `read()`.

However, triggering this is rather difficult as `write()` should only
reach `recv()` while the handshake isn't complete and until then
`process_application()` doesn't accept application data.  But if the
handshake is completed during a call to `write()` that follows a
non-blocking read and data immediately arrives, it's theoretically
imaginable.  This scenario is highly unlikely on a TLS server, which
starts the process with a call to `read()` that then basically loops
until the handshake is done.  Even if multiple calls are required, the
server will generally not call `write()` before it received application
data.  And any calls to `write()` afterwards do not reach `recv()`
anymore (unless no data to send was passed, which would be weird, or
maybe for some weird corner case that lets `build()` fail before all
outbound application data was processed).
2026-07-21 10:37:43 +02:00
Tobias Brunner b3c0019c84 pgp: Fix validity calculation and potential overflow
The two fields were swapped in the calculation and the new code also
avoids overflowing on 32-bit systems.

Fixes: 4cb0e1bb76 ("Added basic support for PGP certificates (no trust relationships yet)")
2026-07-21 10:37:43 +02:00
Tobias Brunner 3582906332 github: Disable SonarQube's (beta) taint analysis
This does not seem to work on these runners.  Tried setting
dataflowMemoryLimit, but that only seems to affect the analysis (which
causes a warning: "Taint analysis was stopped early due to low memory.
The analysis may not have explored the whole program.") not the
post-processing that evidently causes the runner to get killed due to
OOM (there is no explicit error, but in the debug log we see "The runner
has received a shutdown signal", which apparently can indicate OOM
issues).
2026-07-21 10:21:51 +02:00
Tobias Brunner 33917415df github: Use tpm2-tss 4.2.0 for tests 2026-07-21 10:21:51 +02:00
Tobias Brunner 4eb3391801 github: Use AWS-LC 5.3.0 for tests 2026-07-21 10:21:51 +02:00
Tobias Brunner 6894b33e6d child-create: Don't fail creating IKE SA if only Child SA installation fails
Fixes: d7760416d6 ("child-create: Add support for multiple key exchanges")
2026-07-21 10:21:51 +02:00
Tobias Brunner 8cd4ac9f53 github: Use latest SonarQube action 2026-07-21 10:21:51 +02:00
Tobias Brunner 24c70db4b9 aesni: Split plugin to avoid potential SIGILL
Because the CFLAGS applied to the whole plugin, the compiler could
"optimize" the boilerplate plugin code, which could then cause a SIGILL
on hardware that doesn't support such instructions.  This change makes
sure only the actual AES implementation is compiled like that, which
would then not get registered depending on the CPU feature detection.
2026-07-21 10:21:51 +02:00
Tobias Brunner 9d5e619e19 ha: Make receive buffer size for the HA socket configurable
If there are lots of SAs to be synced, the default might be too low
and messages and SAs get dropped.  The new default is already 8 MiB,
which should work fine for lots of SAs.  The code mirrors the one in
the kernel-netlink plugin (but with a guard around SO_RCVBUFFORCE, even
though this plugin is mostly used on Linux as well).
2026-07-21 10:21:51 +02:00
Tobias Brunner 3ef091815f testing: Run test scripts in a subshell so we can properly cancel them
This fixes handling of SIGINT (CTRL+C) so we don't continue with the
next potentially hanging command (e.g. several pings after another that
fail because a required SA didn't come up correctly).  We try to kill
the PID for every SIGINT in case the first one arrived before the
subshell was started.  The `TDUP_<host>` variables are not updated in
the main shell when `stop_tcpdump` is called from the subshell, so
it is called redundantly during the cleanup (removed the useless guard
there and use pkill to suppress any messages if no process is found).

If we get interrupted during one of the init/cleanup WAIT_FOR waits,
we just let them running in the background when exiting the script.
They should generally not do any harm (and be terminated once the next
run is attempted, which might require a rebuild during development
anyway).

Since a103f3a284 ("testing: Add options to only run pre- or posttest
scripts of a scenario") we can now also skip the remaining steps easily.

However, we do run the posttest script to clean up properly (e.g.
terminate the daemons, restore firewall rules etc.).  That's also why
it's not running in a subshell.
2026-07-06 19:01:19 +02:00
Tobias Brunner fa56cca73b testing: Format link to test results as OSC 8 hyperlink
Useful for terminals that support these (but maybe don't parse URLs
automatically).
2026-07-01 09:28:07 +02:00
Tobias Brunner 9326e4707b github: Remove installation of unnecessary debug symbols for OpenSSL
These are apparently not necessary anymore and since there are often
sync issues (package version mismatch if security fixes are shipped
because there is no *-security suite in the ddebs repo), lets not
install them anymore.
2026-06-29 17:50:32 +02:00
Tobias Brunner 02ade69543 vici: Update supported Python versions
Debian bullseye still ships 3.9, while Alpine and newer Ubuntu releases
ship 3.14.
2026-06-29 17:45:29 +02:00
Tobias Brunner b727eb88b4 github: Use AWS-LC 5.1.0 for tests
New version scheme (started after 1.73.0 with 4.0.0).
2026-06-29 17:45:29 +02:00
Tobias Brunner 7eefadca67 Use wolfSSL 5.9.2 for tests 2026-06-29 17:45:29 +02:00
Tobias Brunner 528898a976 unit-tests: Allow Ed448 implementations to fail parsing small-order public keys
We already adapted the Ed25519 test with 36b1a6d76c ("Use Botan 3.1.1
for tests"), now wolfSSL refuses to create such Ed448 keys as well.
2026-06-29 17:45:29 +02:00
Tobias Brunner 98b133c54c wolfssl: Adapt to removed ML-KEM header
The mlkem.h header that mainly defined aliases for the old wc_Kyber* API
has been removed and its contents moved to the wc_mlkem.h header.
2026-06-26 08:10:16 +02:00
Tobias Brunner ae7bb3bd42 github: Use OpenSSL 3.6.3 and 4.0.1 for tests 2026-06-09 13:54:06 +02:00
Andreas Steffen 5973ff8e41 Version bump to 6.0.7 2026-06-07 19:54:14 +02:00
Tobias Brunner d7e305f93f NEWS: Add news for 6.0.7 and info about CVE-2026-47895 2026-06-05 17:36:10 +02:00
R. Elliott Childre 075323d895 identification: Fix double-free when cloning empty IDs
The clone() method was missing a branch when there is an encoded chunk
of length 0 that still needed to be cloned.  Otherwise, the destruction
of the clone frees the same pointer that the original owns.

This double free was found with an improved `fuzz_ids` fuzz harness and
a two byte input to create an identification from "@#" or [0x40, 0x23].
It can also be triggered with `<type>:#` e.g. `dns:#`.

One of the problematic constructors is used to parse EAP-Identities,
which are cloned before storing them in the auth-cfg.   So this can be
triggered by an unauthenticated attacker.

Note that while the length check was already added with 418dbd6243
("cloning %any ID without zero-byte memleak") and identities that trigger
this can be created since 86ab5636c2 ("support for @#hex ID_KEY_ID
identification_t"), it was the referenced commit that made the length
check problematic.

Fixes: 2147da40a5 ("simplified identification_t.clone() using memcpy")
Fixes: CVE-2026-47895
2026-06-05 17:35:06 +02:00
Tobias Brunner 5fc403702b leak-detective: Also ignore unknown memory freed in OPENSSL_cleanup()
It seems that 18a94525a7 was a bit hasty.  Apparently, it's still the
case that there were reports (at least in some test scenarios).  Luckily,
the new facility added in the previous commit allows us to whitelist
these allocations without having to ignore all unknown memory.
2026-06-05 16:58:45 +02:00
Tobias Brunner 3216646bdb leak-detective: Add workaround for unknown memory reports with glibc
With glibc, there is an issue if TZ is not set, which causes a change
of the internally cached TZ value.  Because the original value was
cached before LD was active via `init_static_allocations()`, the memory
is freed as unknown memory later.  This change allows whitelisting
a function that might free such memory (tzset() only for now).
2026-06-05 16:40:49 +02:00
Tobias Brunner 4df53109a5 eap-aka: Make sure AT_RAND has the correct length in AKA-Challenge
This prevents an OOB read if the AT_RAND data is shorter than the
expected 16 bytes.

The check for AT_AUTN is changed for consistency even though its length
is already enforced by the parser (for AT_RAND it isn't because EAP-SIM
expects a length of either 32 or 48 bytes).

Fixes: aea334ec1c ("Splitted EAP-AKA in peer and server implementations, use libsimaka helper library")
2026-06-04 11:31:11 +02:00
Tobias Brunner a904f9125d kernel-netlink: Enable mixed-family IPComp scenarios
Since 6.3, the kernel allows setting XFRM_STATE_AF_UNSPEC for transport
mode SAs, which allows mixed-family use of IPComp.
2026-06-04 11:22:58 +02:00
Tobias Brunner 531de4d858 pkcs7: Fail parsing PKCS#7 signed-data if content can't be parsed
This avoids a crash after verifying the signed attributes in the signature
enumerator.
2026-06-01 18:21:43 +02:00
Tobias Brunner 74fd2593a7 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.
2026-06-01 09:03:02 +02:00
Tobias Brunner 64e01e2812 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.
2026-06-01 08:54:49 +02:00