CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/11/04 09:05:13
Modified files:
sbin/isakmpd : Tag: OPENBSD_7_9 crypto.c dpd.c exchange.c
exchange.h ike_auth.c ike_phase_1.c
ike_quick_mode.c ipsec.c ipsec.h isakmpd.8
key.c log.h message.c monitor.c nat_traversal.c
pf_key_v2.c policy.c prf.c sa.c udp.c
udp_encap.c x509.c
Log message:
Avoid infinite loop when parsing PFKEY replies
In bgpd, iked, isakmpd, ldpd and sasyncd we have similar code to
parse PFKEY replies from the kernel. To avoid an infinite loop on
malformed replies validate the SADB extension size.
For consistency with the other daemons rewrite the parsing loop of
iked.
sasyncd already validates the extension size, so no change needed.
from hshoexer@; OK claudio@ tb@ tobhe@
isakmpd(8): Fix NULL dereference in message_alloc_reply() callers
message_alloc_reply() dereferences the returned pointer of
message_alloc() without a NULL check. Add one so callers can handle
the failure.
Also add NULL checks at both call sites in exchange.c.
from hshoexer@; test & OK sthen@
isakmpd(8): Fix possible unaligned 32 bit read
When validating IPsec SPIs in a DELETE message, access to the
32 bit SPI value might be unaligned. On platforms requiring strict
alignment, this would cause termination of isakmpd by signal.
To avoid this, memcpy(3) the SPI value to a local variable.
from hshoexer@; test & OK sthen@
isakmpd(8): Validate DELETE payload SPI array size [1/2]
The number of SPIs provided in a DELETE message is not properly
validated. This might cause a read beyond the message end. However,
the outside read is limited to 4 bytes for IPsec SAs and 16 bytes
for ISAKMP SAs. A crash is possible, but seems unlikely to me.
from hshoexer@; test & OK sthen@
isakmpd(8): Validate DELETE payload SPI array size [2/2]
Similar to message_validate_delete() also validate in
ipsec_handle_leftover_payload() that the provided number of SPIs
actually fit in the payload. This is redundant as we already would
bail out in message_validate_delete().
from hshoexer@; test & OK sthen@
isakmpd(8): Validate proposal and transform sizes
Check
- that a proposal payload fits within the outer SA payload,
- that the provided SPI and the following transform header fit within
the proposal, and
- transforms fit within the outer proposal payload.
It's already ensured that we never read outside the message. However,
within the message the mentioned payloads might be misinterpreted due
to malformed size values.
from hshoexer@; test & OK sthen@
isakmpd: Fix NULL dereference in message_validate_sa()
When the responder cookie is non-zero but sa_lookup_by_header()
finds no matching SA, msg->isakmp_sa is NULL. Thus check before
dereferencing.
from hshoexer@
isakmpd: Bound check decode_16() in ipsec_decode_attribute()
Before decoding a 16 bit TLV value verify that the provided value
is at least 16 bit in size.
The LIFE_DURATION attributes will already be validated individually,
so just pass them on.
from hshoexer@; OK markus@
isakmpd: Bound check decode_16() in ipsec_is_attribute_incompatible()
Before decoding a 16 bit TLV value verify that the provided value
is at least 16 bit in size.
from hshoexer@; OK markus@
isakmpd: Bound check decode_* in policy_callback() and attribute_unacceptable()
Before decoding 16-bit or 32-bit TLV values, verify that the provided
values have proper minimum size.
from hshoexer@; OK markus@
isakmpd: Bound check ID-payload memcmp()
Make sure the ID supplied by the peer is the size anticipated from
the configuration. Only apply memcmp() if the size matches.
Otherwise, reject the ID right away.
from hshoexer@; OK markus@
isakmpd: Do not leak transport in error paths of udp_encap_handle_message()
This is simiar to what we do in udp_handle_message() in udp.c.
from hshoexer@; OK markus@
isakmpd: Enforce per-type ID payload size in ipsec_validate_id_information()
from hshoexer@; OK markus@
isakmpd: Only call sa_isakmp_upgrade() when ISAKMP SAs actually exist
Informational and transactional exchanges do not have ISAKMP SAs.
Therefore only upgrade ISAKMP SAs when these actually exist.
from hshoexer@; OK markus@
isakmpd: Clear key material
Track allocated sizes alongside the key pointers.
from hshoexer@
isakmpd: Clear sensitive data with freezero()
from hshoexer@; OK markus@
isakmpd: Handle malformed MONITOR_BIND message
Using a stack allocated sockaddr_storage avoids the malloc(3)
entirely. Add length checks for the payload sent by the child.
When a malicious child sends us a malformed message the privsep
protocol is out of sync. Thus terminate gracefully with log_fatalx().
While there, attribute log_fatalx() with __dead.
Reported by Shibo, Hugo Systopia Team
from hshoexer@; OK markus@ tb@ deraadt@
knf
from deraadt@
using sizeof is recommended practice
from deraadt@
remove comma after final SEE ALSO reference
from jsg@
isakmpd(8): Fix various remotely triggerable crashes
- Only accept authenticated DPD notifications with a well-formed payload.
- Check the notify payload length against the SPI size.
- Fail AES key setup on invalid key lengths.
- Reject encrypted messages whose length is zero or not a multiple
of the cipher block size.
- Do not free the caller's certificate in x509_cert_get_key().
- Do not run exchanges that are already finalized.
from hshoexer@; with markus@, some input from tb@, OK deraadt@
this is errata/7.9/041_isakmpd.patch.sig