Commit Graph
26 Commits
Author SHA1 Message Date
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 <research@johannes-moeller.dev>

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 e454b4adb3 libsimaka: Prevent out-of-bounds read when parsing attributes with actual length field
These attributes contain a 16-bit length field for the actual length of
the data in bits or bytes, as compared to the length in 4-byte blocks in
the attribute header.  The previous code didn't correctly account for the
length of the fixed header (4 bytes) when it compared the parsed length
to the length in the header.  This could cause an out-of-bounds read of
up to four bytes beyond the end of the attribute/message.

Fixes: f8330d0395 ("Added a libsimaka library with shared message handling code for EAP-SIM/AKA")
2026-04-02 08:14:29 +02:00
Tobias Brunner 19ef2aec15 Update copyright headers after acquisition by secunet 2022-06-28 10:22:56 +02:00
Tobias Brunner 1b67166921 Unify format of HSR copyright statements 2018-05-23 16:32:53 +02:00
Tobias Brunner 2db6d5b8b3 Fixed some typos, courtesy of codespell 2018-02-13 12:19:54 +01:00
Tobias Brunner 525cc46cab Change interface for enumerator_create_filter() callback
This avoids the unportable 5 pointer hack, but requires enumerating in
the callback.
2017-05-26 13:56:44 +02:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Tobias Brunner f05b427265 Moved debug.[ch] to utils folder 2012-10-24 16:00:51 +02:00
Tobias Brunner 12642a6831 Moved data structures to new collections subfolder 2012-10-24 16:00:49 +02:00
Martin Willi 3b96189a2a Add a return value to crypter_t.decrypt() 2012-07-16 14:53:38 +02:00
Martin Willi e35abbe588 Add a return value to crypter_t.encrypt 2012-07-16 14:53:37 +02:00
Martin Willi 6a3e4ed916 Check rng return value when generating SIM/AKA message IVs 2012-07-16 14:53:37 +02:00
Martin Willi 2e96de60a8 Add a return value to signer_t.get_signature() 2012-07-16 14:53:33 +02:00
Martin Willi 264e702109 Add a return value to simaka_message_t.generate() 2012-07-16 14:53:33 +02:00
Tobias Brunner edad908792 Fixed compiler warnings regarding enum comparison.
Warnings like

  comparison of unsigned expression < 0 is always false

are reported with -Wextra when enum types that are compiled to an
unsigned type (which is up to the compiler) are checked for negativity.
2011-11-25 09:40:30 +01:00
Martin Willi f9152a56ab Migrated simaka_message to INIT/METHOD macros 2011-08-08 13:36:56 +02:00
Martin Willi efee3ed80f Migrated all SIM/AKA code to libsimaka, use SIM and AKA backend managers registered by name 2011-08-08 13:36:56 +02:00
Martin Willi 3102d8669d Use IV length of a crypter instead of block size for IV calculations 2010-08-13 17:11:53 +02:00
Martin Willi ed5fc4cafe Use message instead of attributes in hook 2010-02-26 11:44:34 +01:00
Martin Willi 5a91fd4536 Invoke attribute/key hooks from libsimaka 2009-11-30 09:27:34 +01:00
Martin Willi 454b59c5fd EAP-SIM/AKA crypto helper supports key derivation for fast reauthentication 2009-11-12 10:34:00 +01:00
Martin Willi f81760dcd1 A SIM/AKA message can be parsed twice, without and with decryption 2009-11-12 10:34:00 +01:00
Martin Willi 0e20893d81 Pass SIM/AKA crypto helper to constructor of message 2009-11-12 10:34:00 +01:00
Martin Willi fad4e5f393 Centralized SIM/AKA notifications and client errors 2009-11-12 10:33:59 +01:00
Martin Willi e9c03f5243 Use the EAP-SIM/AKA crypto helper in EAP-SIM 2009-11-12 10:33:59 +01:00
Martin Willi f8330d0395 Added a libsimaka library with shared message handling code for EAP-SIM/AKA 2009-11-12 10:33:58 +01:00