Commit Graph
2526 Commits
Author SHA1 Message Date
Tobias Brunner bf438cb182 vici: Make IKEv2 the default IKE version
We don't want to accept IKEv1 clients anymore by default, so we also
warn them about it in the log.
2026-07-31 16:07:52 +02:00
Tobias Brunner 2f9b52bd1b tnccs-dynamic: Remove unused plugin
With only TNCCS-2.0 supported, there is no need for this plugin.
2026-07-27 08:09:39 +02:00
Tobias Brunner 1fa33a0631 tnc-ifmap: Remove prototypical IF-MAP plugin
This was primarily used in our labs to visualize some TNC aspects but
the third-party daemon and frontend we used have not seen any development
in a decade.  There never was any industry interest in this protocol
anyway, so just remove it.
2026-07-27 08:09:39 +02:00
Tobias Brunner 9f6273786e led: Remove unused plugin
This was originally developed for a custom device.  No known users for
years.
2026-07-24 15:20:24 +02:00
Tobias Brunner 8b2e60b62b duplicheck: Remove confusing plugin
This plugin was developed for a customer who had very specific
requirements.  It never did anything useful for regular users and
usually caused confusing errors if they enabled it by mistake.  So
just remove it.
2026-07-24 15:20:24 +02:00
Tobias Brunner e535ba99ac android-dns: Remove legacy Android DNS plugin
This was written for the original native Android port.  It was never used
by the later Android app.
2026-07-24 14:59:55 +02:00
Tobias Brunner ac690f1a5e medsrv/medcli: Remove prototypical medsrv web application and plugins
This was from a student project that has never been developed further.
And similar to the manager web application it lacks all sorts of modern
standards.  So just remove it and the two plugins it relied on.

The test scenario is renamed to avoid confusion (neither of the two
p2pnat scenarios uses medsrv/medcli).
2026-07-24 14:45:27 +02:00
Tobias Brunner 96b0011d30 smp: Remove legacy configuration/control interface
This has been replaced by VICI years ago, the only remaining user was
the manager.  So remove this as well.
2026-07-24 14:44:54 +02:00
Tobias Brunner 459fcabd9e chunk: Improve constant time comparison for chunks with unequal length
While for most uses the length is fixed and public (e.g. PRF/MAC outputs),
there are a few (e.g. in xauth-generic) that compare variable length
data.

The previous code directly leaked a differing length by short-circuiting
before comparing anything.  While we could limit the comparison by the
minimum length (and call `memeq_const()`), that could still leak the
length because the time will plateau once the secret's length is reached.
Similarly, if the comparison was bound by the longer chunk (would prevent
the use of `memeq_const()`), the length could also be revealed once the
input gets longer than the secret and the time increases.

This changes the semantics of the function by declaring the first
argument the expected/reference secret and the second the variable input.
This strictly makes the function constant-time, bound by the secret's
length.  So the length can't be guessed by providing different input (but
if an attacker can trigger the comparison against different secrets, of
potentially known lengths, it might still be possible).  If the chunks
are known to have the same length, the order doesn't matter.

Callers of this function have been updated accordingly.
2026-07-24 08:47:39 +02:00
Tobias Brunner 94e97eb183 eap-ttls: Fix memory leaks in error cases related to EAP-Identity handling
Should be rare that the eap-identity plugin is not loaded when
authenticating clients with EAP.  And the second error path will
currently never get used as `process()` always succeeds.

Fixes: 79f2102cb4 ("implemented server side support for EAP-TTLS")
2026-07-24 08:47:39 +02:00
Tobias Brunner b6ff363e1c stroke: Avoid sharing a certificate printer between multiple clients
If multiple clients call list commands concurrently, each would replace
the global certificate printer instance the previous client created
and then operate on shared state.  The destruction then causes a
double-free or NULL-pointer dereference.

Fixes: 02d431022c ("Refactored certificate management for the vici and stroke interfaces")
2026-07-24 08:47:39 +02:00
Tobias Brunner 322d947a04 eap-sim-pcsc: Properly release context if determining list of readers fails
Fixes: 80dca77a50 ("Added SIM card backend based on pcsc-lite")
2026-07-24 08:47:39 +02:00
Tobias Brunner 918e052ae1 eap-md5: Avoid memory leak caused by repeated challenges
Fixes: 4b403e7672 ("merged EAP-MD5 into trunk")
2026-07-24 08:47:39 +02:00
Tobias Brunner 4eaaf19217 kernel-netlink: Properly clean up pending entry if VIP installation failed
This could prevent the VIP from getting installed later and actually
causes those threads to block indefinitely as they wait for the entry to
either get removed or the VIP marked as installed, which will never
happen.

Fixes: c6b401581a ("Changed how kernel-netlink handles virtual IP addresses")
2026-07-24 08:47:39 +02:00
Tobias Brunner c52fd0c518 ha: Fix offset checks in HA address pool
This applies some of the same fixes found in the previous commit but also
ensures that the offsets are valid before accessing the bitmask.  Because
of an off-by-one error in the latter, the last address could get released
incorrectly (the pool constructor explicitly excludes it).

Fixes: 98d0343870 ("Implemented a HA enabled in-memory address pool")
2026-07-24 08:47:39 +02:00
Tobias Brunner a3ebaa82de xauth-pam: Use proper method to read session option 2026-07-24 08:47:38 +02:00
Tobias Brunner 268c11fa8c vici: Fix leak if selectors for redirect command are missing or invalid
Fixes: 43b46b26ea ("vici: Add redirect command")
2026-07-24 08:47:38 +02:00
Tobias Brunner e03ec46466 vici: Fix memory leaks if loading CA cert in authority section fails
The return value is now also fixed.  The reply allocation previously
prevented that sections with failed CA certs were rejected.

Also fixes two potential leaks if duplicate settings are sent by a VICI
client.

Fixes: 63d370387d ("vici: Certification Authority support added.")
2026-07-24 08:47:38 +02:00
Tobias Brunner 98fd5e9893 ha: Fix memory leak if Child SA key derivation fails
Fixes: aa334daa9b ("Use a sync message cache to resynchronize IKE_SAs without rekeying")
2026-07-24 08:47:38 +02:00
Tobias Brunner 77cfa835cd connmark: Only install one rule per Child SA in PREROUTING
These rules don't depend on traffic selectors, so for SAs with multiple
traffic selectors we'd install several duplicate rules.  Since this
plugin is used for transport mode SAs, it probably never was an issue
in practice.

Fixes: b8973b2661 ("connmark: Add CONNMARK rules to select correct output SA based on conntrack")
2026-07-24 08:47:38 +02:00
Tobias Brunner dd6a984afb xauth-generic: Make sure to only use secrets that match the username
This ensures that secrets that are associated with the server identity,
usually they are assigned to the username exclusively, will only be tried
if the username also matched.  Otherwise, it could be possible for users
who know at least one password to impersonate another user.

Fixes: 462c9a4f72 ("Try all matching XAuth secrets we find, not only the first one")
2026-07-24 08:47:38 +02:00
Tobias Brunner 485f7645a2 kernel-wfp: Add support for SA deletion in either order
The code was written with `child_sa_t::destroy` in mind, which deletes
the inbound SA before the outbound SA.  The problem is that the rekeying
code was changed meanwhile so the outbound SA is removed before the
inbound SA in order to avoid traffic loss.  That could cause a
use-after-free as the already destroyed item remained in the `isas` list.

This change fixes this so the SAs can be removed in any order.  The SPIs
are used as marker for whether a specific direction is installed.  It
also fixes an issue in `expire_job()`, which removed the entry from
`osas` without holding the lock.

Fixes: f351d9ef7d ("kernel-wfp: Reference SA/SP sets by SPI and destination, not reqid")
Fixes: 44107cb7b7 ("child-delete: Delay the removal of the inbound SA of rekeyed CHILD_SAs")
2026-07-24 08:47:38 +02:00
Tobias Brunner 6419fc8d3c eap-radius: Limit number of concurrently cached DAE responses
An attacker who knows the shared secret could send DAE requests from
different IPs/ports to produce basically unlimited cached responses.
2026-07-24 08:47:38 +02:00
Tobias Brunner 47a583dfa2 socket-win: Bind the sockets exclusively
This prevents other processes from binding the same ports and
misusing the protocol/port-specific bypass rules installed in WFP to
bypass the VPN.

Fixes: 11e7d0677c ("socket-win: Install IKE bypass policies using bypass_socket()")
2026-07-24 08:47:37 +02:00
Tobias Brunner 2ed81ed53a eap-radius: Fix access to IKE_SA when sending interim updates
The previous code checked in the IKE_SA before using it again to
add attributes based on it to the interim update message.  This
change ensures the IKE_SA is only accessed while it is checked out.
The Acct-Status-Type attribute is still sent first, but the
Acct-Session-Id and Class attributes are now sent after the IKE
parameters, which shouldn't really matter, though.

Fixes: d019764ab6 ("Add support for RADIUS Interim accounting updates")
2026-07-24 08:47:37 +02:00
Tobias Brunner 8b1f8e0e46 kernel-pfroute: Remove IP addresses from hashtable if interface disappears
Fixes: f80093e2ee ("kernel-pfroute: Delete interfaces on RTM_IFANNOUNCE/IFAN_DEPARTURE events")
2026-07-24 08:47:37 +02:00
Tobias Brunner 7a1c801512 vici: Also wipe cached PINs during clear-creds command
The PINs are not necessary anymore when we remove all loaded private keys.

Fixes: 2ceeb96db5 ("vici: Add command to load a private key from a token")
2026-07-24 08:47:37 +02:00
Tobias Brunner d3d7a27e46 eap-aka-3gpp: Fix length when logging AUTS and increase some log levels 2026-07-24 08:47:36 +02:00
Tobias Brunner 7a215e568e eap-aka-3gpp2: Log potentially sensitive material on level 4
Leave stuff that's exchanged publicly (e.g. RAND, AUTN) at level 3.
2026-07-24 08:47:36 +02:00
Tobias Brunner b31ce69722 eap-ttls: Add an upper bound for the length of the parsed AVP
On typical systems that have overcommitting enabled, the 16 MiB maximum
that's allocated via the 24-bit length field in the AVP header shouldn't
be an issue as there are various limits that affect how much data can
actually be written to the allocated buffer (e.g. the maximum IKE message
size, the maximum TLS record size, or the maximum number of accepted
EAP-TTLS payloads), so this is primarily a defense-in-depth measure.

The length field of an EAP payload, which is the only type of AVP we
accept, is 16 bits, so that's what we now enforce as maximum.
2026-07-24 08:47:36 +02:00
Tobias Brunner c485080958 connmark: Fix undefined shift if traffic selector is /0
Same as the previous commit for consistency, but not an issue here as
only transport mode SAs are handled.

Fixes: b8973b2661 ("connmark: Add CONNMARK rules to select correct output SA based on conntrack")
2026-07-24 08:47:36 +02:00
Tobias Brunner 117cf65030 forecast: Fix undefined shift if traffic selector is /0
Not an issue in typical scenarios where the plugin is used on a gateway
with roadwarriors that use /32 addresses.  But could be an issue if used
on a client that tunnels everything to the gateway.

Fixes: e5ad2e6614 ("forecast: Add the broadcast/multicast forwarding plugin called forecast")
2026-07-24 08:47:36 +02:00
Tobias Brunner 6b58665697 kernel-wfp: Uninstall policies before deleting provider
The policies reference the provider, so it might not actually get removed
and be left dangling in the WFP system (maybe Windows refcounts it and
still removes it).
2026-07-24 08:47:36 +02:00
Tobias Brunner dd94e8d70e systime-fix: Unregister validator also if time got valid
This avoids accepting expired certificates again should the time get
rolled back for some reason.

Fixes: c81b87ac26 ("systime-fix: Add timeout option to stop waiting for valid system time")
Fixes: 295e42a47f ("systime-fix disables certificate lifetime validation if system time not synced")
2026-07-24 08:47:36 +02:00
Tobias Brunner be4b9f4aaa xauth-pam: Properly initialize response array when handling sessions
This is documented as a requirement in the man page, so the caller of the
conversation function might expect such an array.  Although, since we
only accept non-interactive requests, for which no response is expected,
it's doubtful whether it will actually try to access elements in the
array.  And if the passed pointer was initialized to NULL, passing it to
free() is probably also fine.

Fixes: 2312504d1e ("xauth-pam: Open/close a PAM session for each connected client")
2026-07-24 08:47:36 +02:00
Tobias Brunner 66f0f3a599 kernel-netlink: Add some safety checks when printing extended error messages
The previous code could potentially cause out-of-bound reads.

Fixes: 7988aea7d8 ("kernel-netlink: Log extended ACK error/warning messages")
2026-07-24 08:47:36 +02:00
Tobias Brunner db3f4c2955 eap-radius: Avoid NULL-pointer dereference in XAuth backend
Fixes: c434b2a4a9 ("eap-radius: support plain XAuth RADIUS authentication using User-Password")
2026-07-24 08:47:35 +02:00
Tobias Brunner b031cd27a8 connmark: Fix addresses when removing policies in ike_update() handler
These were never correct.  And the first referenced commit, unfortunately,
just simplified the incorrect code.

Fixes: 08a3ee0cce ("bus: Change ike_update() signature and only call it once")
Fixes: b8973b2661 ("connmark: Add CONNMARK rules to select correct output SA based on conntrack")
2026-07-24 08:47:35 +02:00
Tobias Brunner 289d776904 dhcp: Make sure to only modify transactions after receiving an expected DHCP OFFER
The `transaction` variable was previously still set to the one that
was enumerated last even if the received DHCP OFFER did not match
it.  So the transaction was incorrectly modified.  Once the real
DHCP OFFER would arrive, it would get modified again, but it could
allow adding unintended DNS servers.
2026-07-24 08:47:35 +02:00
Tobias Brunner 7a316d9159 kernel-libipsec: Remove exclude route (reference) if route is updated
Fixes: 587bdf8768 ("kernel-libipsec: Track policies and automatically install routes")
2026-07-23 10:26:08 +02:00
Tobias Brunner e36a8c0d62 kernel-pfkey: Remove exclude route (reference) if route is updated
Fixes: df919d50d0 ("kernel-pfkey: install exclude routes if kernel-net requires them")
2026-07-23 10:26:08 +02:00
Tobias Brunner e1609d8159 forecast: Make BPF statements for metadata reads clearer
The kernel ignores the width of these metadata loads, but since we read
32-bit values, this makes it a bit clearer and technically more correct.
2026-07-23 10:26:08 +02:00
Tobias Brunner 8323fbaee7 eap-peap: Don't allow authenticated client to skip EAP-TNC with unexpected EAP-SUCCESS
EAP-PEAP transports results as separate AVPs, we expect one after the
first phase 2 authentication (if not using certificates).  However, with
the previous caching of the result of that, the client could then send
another confirmation as response to the EAP-TNC request to skip it.
Since no group membership is set if EAP-TNC is not complete, it shouldn't
really affect its outcome, though.

Fixes: 1be296dfb2 ("implemented the PEAP tunneling protocol as an EAP plugin")
2026-07-23 10:26:08 +02:00
Tobias Brunner 5e51fc7902 tnc-pdp: Fix lock type when adding/replacing a connection
The entry was updated and the previous EAP method and IKE SA destroyed
under a read lock, which is not safe (there could be threads in
get_state(), or even some that called it before and now still hold
that read lock while interacting with the EAP method).

Fixes: 37884ab10f ("Add locking to TNC-PDP connections")
2026-07-23 10:26:08 +02:00
Tobias Brunner dc8fa5fea5 tnc-pdp: Don't remove watcher callbacks on failures 2026-07-23 10:26:08 +02:00
Tobias Brunner cfc72fe901 eap-aka-3gpp2: Fix SQN generation
Same as the previous commit.

Fixes: 424ddf801c ("Do not use monotonic time for AKA sequence numbers, it has an undefined starting point")
2026-07-23 10:26:08 +02:00
Tobias Brunner 371c35612c eap-aka-3gpp: Fix SQN generation
As `tv_sec` is a `time_t`, i.e. typically 64 bits, assigning the result
of `htonl()` leaves the upper 32 bits zero.  Copying from the
`sizeof(time_t) - 4` offset then copies those zeroes on little-endian
systems, which is not what was intended according to the comments.
Another issue was that the type of `tv_usec`, `suseconds_t`, is typically
a `long`, i.e. signed, so shifting the maximum value 0x000f423f (999'999)
by 12 bits technically overflows this.  The cast fixes that.

Fixes: 1aba82bfd7 ("eap-aka-3gpp: Add plugin that implements 3GPP MILENAGE algorithm in software")
2026-07-23 10:26:08 +02:00
Tobias Brunner eec3164b41 xauth-pam: Avoid race for multiple concurrent authentication attempts
The previously static pam_conv instance could get reused by multiple
threads, causing one to use the password of the other.
2026-07-23 10:26:08 +02:00
Tobias Brunner 4bef380ce0 eap-simaka-reauth: Prevent corrupting hashtables during concurrent accesses
Basically the same as the previous commit.

Fixes: edcb2dd35b ("Moved reauth/pseudonym functionality from eap-sim-file to separate plugins, usable by any SIM/AKA backend")
2026-07-23 10:26:08 +02:00
Tobias Brunner 0b5143ae04 eap-simaka-pseudonym: Prevent corrupting hashtables during concurrent accesses
This also protects access to the RNG, which is not always thread-safe.

Fixes: edcb2dd35b ("Moved reauth/pseudonym functionality from eap-sim-file to separate plugins, usable by any SIM/AKA backend")
2026-07-23 10:26:08 +02:00