Commit Graph

336 Commits

Author SHA1 Message Date
Thomas Egerer 8456d6f5a8 ikev1: Don't require AH mapping for integrity algorithm when generating proposal
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-08-25 13:34:36 +02:00
Tobias Brunner 22b839e6e9 ikev1: Accept more than one certificate payload in aggressive mode
Fixes #2085.
2016-08-17 10:30:39 +02:00
Thomas Egerer 40bb4677f7 ikev1: Add support for extended sequence numbers
Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
2016-06-29 11:16:48 +02:00
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Tobias Brunner 319b031a8a payloads: Verify P-CSCF configuration attributes like others carrying IP addresses 2016-03-10 11:57:38 +01:00
Tobias Brunner fab4c845ec ikev1: Send NAT-D payloads after vendor ID payloads in Aggressive Mode messages
Some implementations might otherwise not recognize the NAT-D payload
type.  Also moves SIG and HASH payloads last in these messages.

Fixes #1239.
2016-03-07 14:13:12 +01:00
Tobias Brunner 91d80298f9 ikev1: Send and verify IPv6 addresses correctly
According to the mode-config draft there is no prefix sent for
IPv6 addresses in IKEv1.  We still accept 17 bytes long addresses for
backwards compatibility with older strongSwan releases.

Fixes #1304.
2016-03-03 17:32:03 +01:00
Tobias Brunner 636b2e9b2a ikev1: Assume a default key length of 128-bit for AES-CBC
Some implementations don't send a Key Length attribute for AES-128.
This was allowed for IKE in early drafts of RFC 3602, however, some
implementations also seem to do it for ESP, where it never was allowed.
And the final version of RFC 3602 demands a Key Length attribute for both
phases so they shouldn't do it anymore anyway.

Fixes #1064.
2015-08-17 17:13:50 +02:00
Tobias Brunner f809e485fb Fixed some typos 2015-08-13 15:12:34 +02:00
Tobias Brunner 541543dbfe message: Log message if unknown/disallowed payload received 2015-06-01 09:42:11 +02:00
Tobias Brunner e67161fe9e message: Log original message type of unknown payloads 2015-06-01 09:42:11 +02:00
Tobias Brunner 1507647434 unknown-payload: Use a new private payload type and make original type available
This fixes a DoS and potential remote code execution vulnerability that was
caused because the original payload type that was returned previously was
used to cast such payload objects to payloads of the indicated type (e.g.
when logging notify payloads with a payload type for the wrong IKE version).

Fixes CVE-2015-3991.
2015-06-01 09:42:11 +02:00
Martin Willi 62e0abe759 ikev2: Include fragment number into message ID passed to IV gen
When using a cipher with sequential IVs, we never must pass an identical IV
to the IV generator. To avoid it when using IKEv2 fragmentation, use the lower
bits of the 64-bit message ID as the fragment number.
2015-06-01 09:42:11 +02:00
Martin Willi 823a8a9b46 message: Show the fragmentation numbers in message stringification 2015-06-01 09:42:10 +02:00
Martin Willi 161a015782 utils: Use chunk_equals_const() for all cryptographic purposes 2015-04-14 12:02:51 +02:00
Martin Willi 41fc94c924 encoding: Remove DH public value verification from KE payload
This commit reverts 84738b1a and 2ed5f569.

As we have no DH group available in the KE payload for IKEv1, the verification
can't work in that stage. Instead, we now verify DH groups in the DH backends,
which works for any IKE version or any other purpose.
2015-03-23 17:54:03 +01:00
Martin Willi 42431690e0 diffie-hellman: Add a bool return value to get_my_public_value() 2015-03-23 17:54:03 +01:00
Martin Willi 520d58e010 encoding: Allow ke_payload_create_from_diffie_hellman() to fail 2015-03-23 17:54:02 +01:00
Tobias Brunner 8a0cc3f362 encoding: Add getter for IKE SPIs in IKEv1 DELETE payloads 2015-03-23 17:23:57 +01:00
Tobias Brunner 2ed5f5693d encoding: Don't verify length of IKEv1 KE payloads
The verification introduced with 84738b1aed ("encoding: Verify the length
of KE payload data for known groups") can't be done for IKEv1 as the KE
payload does not contain the DH group.
2015-03-20 16:37:59 +01:00
Martin Willi 84738b1aed encoding: Verify the length of KE payload data for known groups
IKE is very strict in the length of KE payloads, and it should be safe to
strictly verify their length. Not doing so is no direct threat, but allows DDoS
amplification by sending short KE payloads for large groups using the target
as the source address.
2015-03-18 13:33:25 +01:00
Tobias Brunner 159b7bec9e ikev2: Add SIGNATURE_HASH_ALGORITHMS notify payload 2015-03-04 13:54:08 +01:00
Tobias Brunner 75dd984e9e ike: Allow creation of internally used payloads
Since 42e0a317c6 ("ike: Only parse payloads valid for the current IKE
version") payload types are checked before creating objects.  This check
failed for internally used payload types (e.g. proposal substructures),
which have a type >= 256, i.e. outside the IKE payload type range.
2014-12-12 13:10:26 +01:00
Tobias Brunner 728f529c42 ikev1: Use same map for AH and ESP authentication algorithms
The transform identifier used in AH transforms is not the same as the
authentication algorithm identifier used in the transform attributes in
AH (and ESP) transforms.
2014-12-09 11:08:14 +01:00
Tobias Brunner 4141f01671 ikev1: Accept IPComp proposals with 4 octet long CPI values
While they SHOULD be sent as 16-bit values according to RFC 3173
a responder MUST be able to accept CPI values encoded in four bytes.
2014-12-05 15:48:52 +01:00
Tobias Brunner 42e0a317c6 ike: Only parse payloads valid for the current IKE version 2014-12-05 15:41:47 +01:00
Tobias Brunner fac310a467 ike: Make check for known payloads depend on IKE version 2014-12-05 15:41:46 +01:00
Tobias Brunner bf5d0693ef id-payload: Enable multiple calls to get_ts() for subnet traffic selectors
The second call resulted in a /32 subnet previously.
2014-12-05 09:32:38 +01:00
Tobias Brunner b089169752 message: Include encrypted fragment payload in payload (order) rules
Otherwise fragmented CREATE_CHILD_SA exchanges won't get accepted
because they don't contain an SA payload.

It also prevents a warning when ordering payloads.

Fixes #752.
2014-10-29 15:51:38 +01:00
Tobias Brunner 8dbe128c8c message: Limit maximum number of IKEv2 fragments
The maximum for IKEv1 is already 255 due to the 8-bit fragment number.

With an overhead of 17 bytes (x64) per fragment and a default maximum
of 10000 bytes per packet the maximum memory required is 14 kB
for a fragmented message.
2014-10-10 09:32:42 +02:00
Tobias Brunner f00a9c1715 packet: Define a global default maximum size for IKE packets 2014-10-10 09:32:42 +02:00
Tobias Brunner 03512c47bf message: Ensure a minimum fragment length 2014-10-10 09:32:41 +02:00
Tobias Brunner c0f4936a23 message: Fragment and reassemble IKEv2 messages 2014-10-10 09:32:41 +02:00
Tobias Brunner e8ffb256b3 message: Handle encrypted fragment payload similar to the encrypted payload 2014-10-10 09:32:41 +02:00
Tobias Brunner 4c345b15c7 ikev2: Add encrypted fragment payload 2014-10-10 09:32:37 +02:00
Tobias Brunner edfd33455c encrypted_payload: Encrypted payload can be constructed from plaintext 2014-10-10 09:31:17 +02:00
Tobias Brunner 1e0d8f3ec0 encrypted_payload: Expose generate() to generate the plaintext 2014-10-10 09:31:17 +02:00
Tobias Brunner 44996b5866 encrypted_payload: Extract some utility functions 2014-10-10 09:31:17 +02:00
Tobias Brunner 41751a70d9 message: Split generate() in multiple functions 2014-10-10 09:31:16 +02:00
Tobias Brunner 7223b642a7 ikev2: Add notify for IKEv2 fragmentation 2014-10-10 09:31:13 +02:00
Tobias Brunner 70e0be072b ikev1: Move defragmentation to message_t 2014-10-10 09:30:26 +02:00
Tobias Brunner 2e7a2c06a1 message: fragment() generates message and fragments and caches them 2014-10-10 09:30:26 +02:00
Tobias Brunner e0b35142c1 message: Make packet argument optional in generate() 2014-10-10 09:30:26 +02:00
Tobias Brunner 127a98dc90 ikev1: Move fragment generation to message_t 2014-10-10 09:30:26 +02:00
Tobias Brunner 147fe503af ike: Rename encryption_payload to encrypted_payload 2014-10-10 09:30:25 +02:00
Martin Willi 2dee0a85a6 encoding: Accept all exchange types for non IKEv1/IKEv2 major versions 2014-09-22 13:42:11 +02:00
Tobias Brunner 8a6b01dd2a ikev1: Don't cache last block of INFORMATIONAL messages as IV
We don't expect a response with the same MID, but apparently some
devices (e.g. FRITZ!Box) do that for DPDs, while still treating the
response as a new exchange.  By storing the last message block as IV
we can't decrypt the first block of such a response.

Fixes #661.
2014-09-12 13:56:18 +02:00
Tobias Brunner 2e62f51bcc ikev1: Log IV when encrypting messages 2014-09-12 13:56:17 +02:00
Tobias Brunner 2f7fef569b ikev1: Skip unusable IPComp proposals
Fixes #661.
2014-09-12 13:56:06 +02:00
Tobias Brunner 84337ac8d0 ikev1: Properly handle different proposal numbering schemes
While the examples in RFC 2408 show proposal numbers starting at 1 and
increasing by one for each subsequent proposal this is not mandatory.
Actually, IKEv1 proposals may start at any number, the only requirement
is that the proposal numbers increase monotonically they don't have to
do so consecutively.

Most implementations follow the examples and start numbering at 1 (charon,
racoon, Shrew, Cisco, Windows XP, FRITZ!Box) but pluto was one of the
implementations that started with 0 and there might be others out there.

The previous assumption that implementations always start numbering proposals
at 0 caused problems with clients that start numbering with 1 and whose first
proposal consists of multiple protocols (e.g. ESP+IPComp).

Fixes #661.
2014-09-12 13:55:00 +02:00