Commit Graph

148 Commits

Author SHA1 Message Date
Guy Harris 8195bdd340 Rename a bunch of things with "conversation".
A conversation in Wireshark might have two endpoints or might have no
endpoints; few if any have one endpoint.  Distinguish between
conversations and endpoints.
2022-08-25 20:02:20 -07:00
msweant 53dcf53ae5 EAP: Encrypted IMSI Memory Bug
Added complete CertificateSerialNumber string match
logic to prevent malformed strings.  Added ASCII compliance
check prior to identity parsing and expert info warning.  Added
3GPP realm string matching logic to optional Realm token in Encr.
IMSI identities.

Closes #18129.
2022-07-14 19:18:45 +00:00
Guy Harris 1018e39ea3 eap: add a comment asking why dissect_eap_identity_wlan() exists?
Must identity strings in EAP be dissected differently over different
protocols?
2022-07-03 23:27:40 -07:00
Alexander Clouter fdf55aaa51 eap: support tunneled TLS decoding
Using a similar strategy to ce087027ef we
group conversation and pdata use by the layer depth we are decoding.

This now decodes EAP-TLS within TEAP (and should work for TTLS and PEAP)
2022-05-09 18:28:27 +00:00
Alexander Clouter e75f6800ca EAP: fix packet leak caused by ce087027ef
Caught and flagged in https://gitlab.com/wireshark/wireshark/-/merge_requests/6838#note_932484809
2022-05-02 17:12:24 +01:00
Alexander Clouter ce087027ef EAP: massage pinfo for EAPOL so the TLS decoder does not get lost 2022-04-30 13:30:20 +00:00
Alexander Clouter 6843ca2463 EAP: decode TEAP Outer-TLVs 2022-04-30 13:30:20 +00:00
Alexander Clouter 914d8bc756 EAP: add PEAP decoder
The existing PEAP support does not decode the inner attributes, this
commit adds that support by introducing packet-peap.c which recreates
a 'pseudo' EAP header before looping the TVB back into the EAP dissector.
2022-04-30 13:30:20 +00:00
Alexander Clouter 49c730cc23 EAP: use enum for pdata instead of magic numbers
Later for packet-peap.c, need to use pdata to pick into the parent
dissector so here we set up packet-eap.c to use enum.
2022-04-30 13:30:20 +00:00
Alexander Clouter b9681002c5 EAP: add MSAUTH-TLV decoder 2022-04-30 13:30:20 +00:00
Alexander Clouter f694e70771 EAP: improve EAP-TLS flag decoding
Decode TEAP's O-flag.

We also update the diagram and references as PEAPv0 has a different view
of how the flags are used compared to the RFCs and drafts.
2022-04-30 13:30:20 +00:00
Moshe Kaplan 62d6c139b7 packet-eap: Fix memory leak
Fix memory leak in packet-eap.
Coverity ID 1496856.
2022-03-15 09:53:05 +00:00
João Valverde 8efad466c4 Tools: Fix fix-encoding-args.pl ASCII string validation
Do not require a useless ENC_NA parameter for string encodings.
FT_STRING and FT_STRINGZ types don't have any ndianness.

Follow-up to 6ec429622c.
2022-02-15 11:38:16 +00:00
Alexis La Goutte 6d063e0190 EAP: fix Argument with 'nonnull' attribute passed null 2022-02-13 10:34:30 +00:00
Dr. Lars Völker 9db22e8439 EAP: Adding EAP-IKEv2 support
This patch adds basic EAP-IKEv2 support.
This does not include EAP-IKEv2 fragmentation support.
2022-01-18 07:45:53 +00:00
Matthew Weant 29324f9409 EAP: Fix dissection of encrypted IMSI identifiers 2022-01-06 07:27:46 +00:00
Jaap Keuter adbaced04c Dissectors should not include stdio.h, unless needed 2021-12-05 12:45:46 +00:00
Alexis La Goutte 646e3db99a EAP: Add Autority ID Data from EAP-FAST
4.1.1 Authority ID Data https://datatracker.ietf.org/doc/html/rfc4851#section-4.1.1
2021-10-26 20:15:41 +00:00
Evan Huus 8ee8808876 First pass pinfo->pool conversion, part 2
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.
2021-07-21 09:54:57 -04:00
Nardi Ivan 20a6fea312 EAP: fix a memory leak 2021-03-11 19:52:38 +01:00
Martin Mathieson f3bc71c44f Make some more vars and functions static. 2021-02-20 16:34:24 +00:00
Martin Mathieson 0cf834f909 Make some more variables and functions static. 2021-02-14 19:42:01 +00:00
Mikael Kanstrup 3b74cbcf4e EAP: Let dissect_eap_psk_pchannel return offset
For consistency with other functions in this dissector let
dissect_eap_psk_pchannel also return offset instead of "number of
bytes dissected".
2020-10-19 10:09:41 +00:00
Mikael Kanstrup 279bde1a0e EAP: Fix GPSK CSuite Sel dissection
The function to dissect CSuite Sel returns offset not number of
dissected bytes so calling function must assign new offset rather
than incrementing. For consistency also update the CSuite List
function to return offset.
2020-10-19 10:09:41 +00:00
Mikael Kanstrup 72fbe69d9b EAP: Fix GPSK failure code item length
Fix issues found by running ./tools/check_typed_item_calls.py

epan/dissectors/packet-eap.c:1475 proto_tree_add_item called for hf_eap_gpsk_failure_code  -  item type is FT_UINT16 but call has len  4
epan/dissectors/packet-eap.c:1479 proto_tree_add_item called for hf_eap_gpsk_failure_code  -  item type is FT_UINT16 but call has len  4
2020-10-19 10:09:41 +00:00
Joerg Mayer 743dcc7a41 packet-eap.c: Fix a typo in a comment 2020-10-13 13:29:40 +00:00
Alexis La Goutte 82e7835b2e EAP: Fix Dead Store
Fix dead store (Dead assignement/Dead increment) Warning found by Clang
2020-10-01 07:14:40 +00:00
Alexis La Goutte 8201285759 EAP: Avoid to inscrement offset on proto_tree_add_item function 2020-09-22 11:20:09 +00:00
Mikael Kanstrup 2a3f9d2789 Add a few EAP dissectors 2020-09-21 15:05:05 +00:00
Guy Harris 4569772457 eap: fix which tokens we think contain mncNNN and mccNNN.
tokens[] contains two tokens - the part of the identity before @ and the
part of the identity after @.

realm_tokens[] contain five tokens - the "."-separated parts of the part
of the identity after @.

The latter include "mncNNN" and "mncNNN".

This fixes a crash.

Change-Id: I4b13dd90977a626a823cb53958412301abf8addb
Reviewed-on: https://code.wireshark.org/review/38158
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-13 21:49:56 +00:00
Matthew Weant 79e43ef98d EAP: Update to EAP Identity Dissection
Removed WLAN from the EAP identity fields because
it is additional and unnecessary.  Added fields for
the full identity string and the identity type.
Removed the pseudo and reauth identity types by
collapsing all identity values into one field
(eap.identity) so the values may be filtered easier
by users in tshark and the GUI.  Omitting
encrypted IMSI code until this patch and Change
37250 get merged since the encrypted IMSI logic
depends on these two patches.

Bug: 16537
Change-Id: If359756c1949aff2510b822b70e0e79df85213d0
Reviewed-on: https://code.wireshark.org/review/37257
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-10 04:54:21 +00:00
Matthew Weant e312d07367 EAP: Handling Identities with Periods
Fixing EAP WLAN identity dissection to account for
identities that contain periods. Also fixed an issue
with the identity unknown data field where it would
incorrectly calculate the number of remaining bytes
in identity messages.  In that same vein, renamed the
field from hf_eap_identity_unknown_data to
hf_eap_identity_padding as it is only null bytes appended
to the end of identity strings. Lastly, I corrected
the EAP WLAN identity MCC and MNC lookup logic.  It
wrongly assumed that NAI Realm MCC and MNCs should only
exist or dissect with permanent EAP identities which
is not the case.  The algorithm used to perform lookups
would also not resolve all MCC/MNC pairs for the MNC value.

Bug: 16524
Change-Id: I1d9955618dab0c70de9fcd88088a4390989653c7
Reviewed-on: https://code.wireshark.org/review/37250
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-02 05:05:24 +00:00
Matthew Weant ddc5a49ca4 EAP: AT_NOTIFICATION Dissection
Added two fields for EAP-SIM/AKA Notification Type.
Added value_string array for AT_NOTIFICATION types & external ref.
Updated else if statements to a switch for EAP-SIM and EAP-AKA
Updated eap_sim_aka_attribute_vals[] and added Client Error Codes

Bug: 16539
Change-Id: Iaf9949d713d700330536e805d9ceb9328d183744
Reviewed-on: https://code.wireshark.org/review/36999
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-05 20:09:48 +00:00
Matthew Weant dba3081f4d EAP: Unknown Data at end of EAP Identities
Added unknown data field at end of EAP Identity
dissection to ensure clean offsets to CRC/Checksum.

Bug: 16529
Change-Id: I09bc945bb89a91231bb82ced011ca3d1075a7788
Reviewed-on: https://code.wireshark.org/review/37094
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-05 11:58:42 +00:00
Martin Mathieson 88923604b2 Fix up some broken links to specs from dissectors.
check_dissector_urls.py was written and used to
find URLs within epan/dissectors/*.c and try to
fetch them using 'requests'. Will be commmitted
separately.

Most of the changes were to adapt to reorganisation
of IETF or 3gpp2 links, but many of the broken links
are for websites or companies that no longer exist.

Change-Id: Ie9afdb95099218402a61626a0cd5193c6f781b96
Reviewed-on: https://code.wireshark.org/review/36769
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2020-04-12 15:03:14 +00:00
Mikael Kanstrup c583304dd5 Add TEAP dissector
Initial support for TEAP (Tunnel Extensible Authentication Protocol)
defined in RFC7170.

Only partial support implemented. Mainly the parts needed to discover
the carried EAP payload when establishing IEEE802.11 EAP-TEAP
connections.

Bug: 16379
Change-Id: Ic2b31d0b871b430792a371cd09926811e350c32b
Reviewed-on: https://code.wireshark.org/review/36104
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-27 04:28:49 +00:00
Gerald Combs 8bda8642df EAP: Remove a couple of string length assumptions.
Don't assume our MNC and MCC string lengths are > 3.

Bug: 16397
Change-Id: I0759dcb9d0c5f078cf3a98e9323d9cb741e15dd4
Reviewed-on: https://code.wireshark.org/review/36146
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-24 07:42:38 +00:00
Alexis La Goutte c74801c9d9 EAP: Add TEAP (Tunnel EAP)
From RFC7170

Bug: 16379
Change-Id: I1698e87c78ce3cdc3e322cfb112fd99e8d23e3ec
Reviewed-on: https://code.wireshark.org/review/36056
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-02-14 07:46:22 +00:00
Peter Wu b6e42f40d3 EAP: use new tls_set_appdata_dissector API to set the dissector
Passing the appdata dissector via the data parameter caused crashes due
to type confusion, use an alternative, indirect method instead.

Change-Id: I1de3de4e7daf4504c176a6ad8947037606aa20bb
Depends-On: I4770d03f912dd75f92878dd74ad830ebb7eb1431
Reviewed-on: https://code.wireshark.org/review/34312
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-19 04:17:10 +00:00
Peter Wu 4a795a457a EAP: add support for EAP-PEAP
Tested with the three captures from the linked bug: eap-peap-gtc.pcapng,
eap-peap-md5.pcapng, eap-peap-mschapv2.pcapng.

Bug: 15597
Change-Id: Idb1fb2809d05648a3b961af8dbdd9b35c3284c13
Reviewed-on: https://code.wireshark.org/review/34294
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-15 04:05:07 +00:00
Peter Wu f05efc5663 EAP, Diameter: add EAP-TTLS and EAP-Message dissection support
Add support for dissecting the decrypted TLS payload as Diameter.
Add support for dissecting the EAP-Message attribute as EAP.
Disable retransmission detection when EAP-Message is detected (EAP in
TLS in EAP) since this results in false positives.

Tested with captures from Bug 15603:

* eap-ttls-pap.pcapng - ok, User-Name and User-Password AVPs.
* eap-ttls-eap-gtc.pcapng, eap-ttls-eap-md5.pcapng - EAP-Message AVP.
* eap-ttls-mschapv2.pcapng - partially supported, does not conform to
  Diameter AVP requirements as it is not padded. Microsoft vendor types
  are also not yet supported. To be fixed later.
* eapttls-diameter-avp.pcapng (Bug 12880) - EAP-Message AVP.

Bug: 12880
Bug: 15603
Change-Id: Ie7ea282d05c1d3ff8463c34bf259107562714440
Reviewed-on: https://code.wireshark.org/review/34281
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-15 04:04:27 +00:00
Peter Wu 05dc3bf2ce EAP: show expert info for bad EAP lengths
The EAP length field must cover at least Code (1 byte), ID (1 byte),
Length (1 byte) and not have missing data afterwards.

Bug: 14406
Change-Id: I829e2aa33e5f286d55d2e8249457e118e7c3ebcc
Reviewed-on: https://code.wireshark.org/review/34292
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-15 03:58:07 +00:00
Alexis La Goutte b04f675c06 EAP: rename some identity field
Bug: 15991
Change-Id: Ie180f4d8e018e31a138bfaf526fc8538d110901c
Reviewed-on: https://code.wireshark.org/review/34285
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-14 11:28:07 +00:00
Peter Wu 1aaf590fac EAP: ignore retransmissions to avoid breaking EAP-TTLS reassembly
Remember the most recently seen Identifier field for the authenticator
and peer. Flag packets that mismatch and skip further processing if it
could modify the state as is the case for EAP-TTLS.

Bug: 5056
Change-Id: If439d5ef2ae390208f678ff271d3036efaf9fa7f
Reviewed-on: https://code.wireshark.org/review/34261
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-13 07:50:49 +00:00
Peter Wu 40b19131c2 EAP: force a new conversation at EAP-Request/Identify
TLS requires unique conversations for every TLS session. With EAP-TTLS
over EAPOL, only a single conversation was created, breaking TLS.
Force a new conversation at the start of the EAP protocol to fix this.

This alone was not sufficient, the right conversation was not always
matched. This happened due to wildcard matching in EAP (NO_PORT_B) while
TLS does not use NO_PORT_B. TLS ended up setting a dummy port via
"conversation_set_port2" because PT_NONE is considered connection-less.
Even after treating PT_NONE as *not* connection-less in conversation.c,
the EAP Success message was not correctly matched against a conversation
and resulted into creation of another conversation.

To avoid all of that mess, just use the same conversation matching logic
as TLS, without NO_PORT_B. The original conversation tracking logic in
EAP was presumably added to avoid multiple conversations for EAP over
RADIUS (UDP), but that requirement does not seem necessary.

Verified with `tshark -2r eap-tls-bug-cert.pcap -otls.log_file:out.txt`,
two different `conversation =` values exist for the two sessions.

Bug: 15983
Change-Id: I3376624ee3ea627eaa6233d39ae3c1d19bdc98bb
Reviewed-on: https://code.wireshark.org/review/34247
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-12 04:10:17 +00:00
Peter Wu 7bd3edccf1 EAP: show reassembled TLS fragments only on the final frame
This avoids multiple dissections on the second pass which could
potentially break decryption and TLS handshake reassembly.

Bug: 15982
Change-Id: I9f83fbd51c732140b831f7d5f29f46e9694e405c
Reviewed-on: https://code.wireshark.org/review/34237
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-08-11 20:19:57 +00:00
Alexis La Goutte 1999ad7479 eap: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: I1ab6fc7ec046038ab130aef994081051a7f40e19
Reviewed-on: https://code.wireshark.org/review/32987
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-26 11:59:31 +00:00
Dr. Lars Voelker 6a3b24be29 EAP: Passing additional context to allow for reassembly in vendor parser
Currently an extended vendor parser only gets the vendor_type directly and
the vendor_id indirectly. For some cases (eap fragmentation et al.) it is
important to have access to the eap_code and the eap_identifier as well.
This patch is adding this.

Change-Id: I848cbe58dc4f8e4034382a9c9ca43d350a61bb18
Signed-off-by: Dr. Lars Voelker <lars-github@larsvoelker.de>
Reviewed-on: https://code.wireshark.org/review/32944
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-04-23 23:57:25 +00:00
Dr. Lars Voelker cf5b86721a Adding the missing generic method to support multiple vendor-defined ext types
The current EAP dissector assumes that all vendor-defined extended types are
WPS. This does not allow for adding new vendor-defined payloads. This codes
cleans up the limitation. The Vendor-ID can be registered using a dissector
table, while the Vendor-Type is passed as data.

Change-Id: Idc75108fd42b9b2153089db503b137c6eeefe274
Signed-off-by: Dr. Lars Voelker <lars-github@larsvoelker.de>
Reviewed-on: https://code.wireshark.org/review/32888
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-20 06:09:53 +00:00
Guy Harris 7eb3e47fa4 Try to squeeze some bytes out of the frame_data structure.
Make the time stamp precision a 4-bit bitfield, so, when combined with
the other bitfields, we have 32 bits.  That means we put the flags at
the same structure level as the time stamp precision, so they can be
combined; that gets rid of an extra "flags." for references to the flags.

Put the two pointers next to each other, and after a multiple of 8 bytes
worth of other fields, so that there's no padding before or between them.

It's still not down to 64 bytes, which is the next lower power of 2, so
there's more work to do.

Change-Id: I6f3e9d9f6f48137bbee8f100c152d2c42adb8fbe
Reviewed-on: https://code.wireshark.org/review/31213
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-12-27 04:34:29 +00:00