Commit Graph
57 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 <[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 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 52771c1392 simaka-manager: Fix build with DEBUG_LEVEL < 1 2025-01-13 12:02:17 +01:00
Tobias Brunner fea02fb297 simaka-crypto: Fix constructor declaration
Prototype didn't match the implementation.
2024-01-16 11:00:29 +01:00
Tobias Brunner bb06b7a4bb simaka-manager: Fix counter in log message when getting quintuplets
Also fixes the build with DEBUG_LEVEL < 1.
2023-05-08 17:32:17 +02:00
Tobias Brunner 19ef2aec15 Update copyright headers after acquisition by secunet 2022-06-28 10:22:56 +02:00
Josh Soref b3ab7a48cc Spelling fixes
* accumulating
* acquire
* alignment
* appropriate
* argument
* assign
* attribute
* authenticate
* authentication
* authenticator
* authority
* auxiliary
* brackets
* callback
* camellia
* can't
* cancelability
* certificate
* choinyambuu
* chunk
* collector
* collision
* communicating
* compares
* compatibility
* compressed
* confidentiality
* configuration
* connection
* consistency
* constraint
* construction
* constructor
* database
* decapsulated
* declaration
* decrypt
* derivative
* destination
* destroyed
* details
* devised
* dynamic
* ecapsulation
* encoded
* encoding
* encrypted
* enforcing
* enumerator
* establishment
* excluded
* exclusively
* exited
* expecting
* expire
* extension
* filter
* firewall
* foundation
* fulfillment
* gateways
* hashing
* hashtable
* heartbeats
* identifier
* identifiers
* identities
* identity
* implementers
* indicating
* initialize
* initiate
* initiation
* initiator
* inner
* instantiate
* legitimate
* libraries
* libstrongswan
* logger
* malloc
* manager
* manually
* measurement
* mechanism
* message
* network
* nonexistent
* object
* occurrence
* optional
* outgoing
* packages
* packets
* padding
* particular
* passphrase
* payload
* periodically
* policies
* possible
* previously
* priority
* proposal
* protocol
* provide
* provider
* pseudo
* pseudonym
* public
* qualifier
* quantum
* quintuplets
* reached
* reading
* recommendation to
* recommendation
* recursive
* reestablish
* referencing
* registered
* rekeying
* reliable
* replacing
* representing
* represents
* request
* request
* resolver
* result
* resulting
* resynchronization
* retriable
* revocation
* right
* rollback
* rule
* rules
* runtime
* scenario
* scheduled
* security
* segment
* service
* setting
* signature
* specific
* specified
* speed
* started
* steffen
* strongswan
* subjectaltname
* supported
* threadsafe
* traffic
* tremendously
* treshold
* unique
* uniqueness
* unknown
* until
* upper
* using
* validator
* verification
* version
* version
* warrior

Closes strongswan/strongswan#164.
2020-02-11 18:23:07 +01: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
Tobias Brunner 1fafc56b95 Fixed some typos, courtesy of codespell 2016-07-04 12:18:51 +02:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Tobias Brunner 28649f6d91 libhydra: Remove empty unused library 2016-03-03 17:36:11 +01:00
Martin Willi 101d67440f libsimaka: Link against Winsock2 on Windows
The library makes use of htons/ntohs().
2015-04-13 09:31:28 +02:00
Martin Willi 9ee8b3b41f enum: Don't directly include enum.h
To allow enum.h to depend on utils.h definitions, avoid its direct inclusion.
Instead include utils.h, which includes enum.h as well.
2014-05-16 15:42:07 +02:00
Tobias Brunner 9af44ef5d9 Build all shared libraries with -no-undefined and link them properly
The flag is required to convince libtool on Cygwin to build DLLs. But on
Windows these shared libraries can not have undefined symbols, so we have to
link them explicitly to the libraries they reference.

For plugins this is currently not done, so only the monolithic build is
supported.  The plugin loader wouldn't be able to load DLLs anyway, as
it tries to load files that don't exist on Cygwin.
2013-09-12 01:44:49 +02:00
Martin Willi 19cb07b890 automake: replace INCLUDES by AM_CPPFLAGS
INCLUDES are now deprecated and throw warnings when using automake 1.13.
We now also differentiate AM_CPPFLAGS and AM_CFLAGS, where includes and
defines are passed to AM_CPPFLAGS only.
2013-07-18 14:59:19 +02:00
Tobias Brunner 11adf114c1 Fixed Doxygen comments after scanning complete src directory 2013-03-02 18:31:53 +01:00
Tobias Brunner 35ba45916c Fixed two bugs in logging MSK during EAP-SIM/AKA
msk is already a pointer to a chunk_t and it was actually not set yet.
2012-11-21 11:55:55 +01:00
Tobias Brunner f05b427265 Moved debug.[ch] to utils folder 2012-10-24 16:00:51 +02:00
Tobias Brunner d5c143e5be Moved enum_name_t to utils folder 2012-10-24 16:00:50 +02:00
Tobias Brunner 12642a6831 Moved data structures to new collections subfolder 2012-10-24 16:00:49 +02:00
Martin Willi 0d6183f0a9 Fix memory management in SIM/AKA crypto functions 2012-07-16 14:55:07 +02:00
Martin Willi 87dd205b61 Add a return value to hasher_t.allocate_hash() 2012-07-16 14:55:06 +02:00
Martin Willi 8bd6a30af1 Add a return value to hasher_t.get_hash() 2012-07-16 14:55:06 +02:00
Martin Willi ce73fc19db Add a return value to crypter_t.set_key() 2012-07-16 14:53:38 +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 f3ca96b2bf Add a return value to prf_t.set_key() 2012-07-16 14:53:34 +02:00
Martin Willi bc47488323 Add a return value to prf_t.get_bytes() 2012-07-16 14:53:33 +02:00
Martin Willi 2d56575d52 Add a return value to signer_t.set_key() 2012-07-16 14:53:33 +02:00
Martin Willi 86d2cdc1ed Add a return value to simaka_crypto_t.derive_keys_*() 2012-07-16 14:53:33 +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 35a1986142 Fixed additional typos in comments and log messages. 2012-01-12 11:42:42 +01: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
Andreas Steffen 4182d7a58d added dummy libsimaka_init() function needed for integrity testing 2011-11-08 21:18:48 +01:00
Martin Willi c12c334925 Add a plugin feature registration callback for SIM/AKA backends 2011-10-14 10:05:48 +02:00
Martin Willi f9152a56ab Migrated simaka_message to INIT/METHOD macros 2011-08-08 13:36:56 +02:00
Martin Willi d1196ffe58 Migratd simaka_crypto 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 b4853f12f5 Install and link libsimaka as dynamic library 2011-08-08 13:19:02 +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
Tobias Brunner 58f86d0f0f Changed all usages of lib->attributes to hydra->attributes. 2010-03-24 18:54:26 +01:00
Tobias Brunner bd3f8ea30b Convert charon into libcharon. 2010-03-19 13:34:52 +01: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 074444972a Build libsimaka with libtool, as we require a PIC-enabled version 2009-11-12 13:37:07 +00:00
Martin Willi 454b59c5fd EAP-SIM/AKA crypto helper supports key derivation for fast reauthentication 2009-11-12 10:34:00 +01:00