Commit Graph

81279 Commits

Author SHA1 Message Date
Peter Wu a7ef7ff40d CMake: clear stale MaxMindDB cache entries if needed
On macOS with Homebrew, the version is included with the library path.
On updates, the old MAXMINDDB_LIBRARY is invalidated. However
ws_find_package only checks MaxMindDB_LIBRARY. Windows has a similar
problem. Make sure to clear the stale value such that newer versions can
be found, fixing the build.

Fixes #17069
2021-06-24 22:55:50 +00:00
John Thacker 16d9f8948c MP2T: Conversation direction matters for analysis stats
In the fairly rare case where we have multiple MP2T streams in
opposite directions on the same UDP (or other) conversation, keep
their analysis stats and assigned fragment IDs separate. Otherwise
the fragment IDs will be incremented at the wrong time and reassembly
will fail in edge cases.
2021-06-24 20:56:43 +00:00
Dr. Matthias St. Pierre 3ce390a8f9 ipsec: display the encryption and authentication algorithm names 2021-06-24 20:39:20 +00:00
Dr. Matthias St. Pierre 1d38a72db3 ipsec: implement ICV verification for AEAD ciphers
After all the previous refactoring, the ICV verification for AEAD
ciphers is rather straightforward.

Currently, the only supported AEAD cipher is AES-GCM.
2021-06-24 20:39:20 +00:00
Dr. Matthias St. Pierre 70a93118d6 ipsec: refactor the decryption and dissection of ESP packets
Adding full support for AEAD ciphers like AES-GCM (including the
verification of the ICV) turned out to be difficult with the
current implementation of the ipsec dissector, because it does not
separate the dissection and decryption steps well enough and has
too many special cases depending on the crypto algorithms.

From a dissector's viewpoint there shouldn't be much difference
between an authenticated encryption method and a combination of
a classical encryption method with an authentication method.
What matters is how the data is structured, so much how it is
calculated.

       HEADER || IV || ENCRYPTED DATA || ICV      (Frame Data)
                               |
                               v
                       DECRYPTED DATA             (Decrypted Data)

This commit tries to refactor the implementation with the goal to
minimize the differences between the different crypto operations,
in particular their operation modes (like AES-CBC,AES-CTR,AES-GCM).
It follows the example of the isakmp dissector for IKEv2 packets,
which already has a functional AES-GCM support.

The most significant changes are:

- Display the IV and ICV as part of the original Frame Data, not
  as part of the Decrypted Data.

  - Display the location of the encrypted data, together with
    information about encryption and authentication algorithms.

  - Use gcry_cipher_setiv() to set the IV for AES-CBC instead of
    copying the IV into the decryption buffer as a prefix which
    subsequently gets discarded.

  - Don't copy the ICV into the decryption buffer where it gets
    "decrypted" accidentally and needs to be restored afterwards.

- Strip the nonce from the encryption key for AES-GCM and AES-CTR
  at an early stage, to reduce special treatment for those modes
  due to the different key lengths.

- Add some missing dissection tree items to get full coverage
  of all bytes in the Frame Data and Decrypted Data.

- Don't report dissector bugs to stderr. Instead, use the
  REPORT_DISSECTOR_BUG() macro which will raise an exception.
  (If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable
  is set, the program will call abort() instead, to make it easier
  to get a stack trace.)

With these changes, AES-GCM encrypted payloads now get dissected
correctly after decryption, provided the ICV length is specified
correctly. The ICV verification is still missing, it will be added
in a followup commit.
2021-06-24 20:39:20 +00:00
Dr. Matthias St. Pierre c5f1fbd1fc ipsec: rename some variables in the packet-ipsec.c
The renamings serve the purpose to improve the readability of the
code and make it more consistent with the names in packet-isakmp.c.
They are part of the refactoring but where split off into a
separate commit in order to reduce the diff noise in the following
commit, which contains the important changes of the refactoring.
2021-06-24 20:39:20 +00:00
Dr. Matthias St. Pierre 23ef47336c ipsec: add encryption types for AES-GCM with 8,12,16 octet ICV
The current "AES-GCM" encryption type in the `esp_sa` uat file does
not specify an ICV length, contrary to the `ikev2_decryption_table`.
The ICV does not get stripped from the encrypted data before
decrypting and dissecting it, whence the protocol type of the
decrypted frame is looked up at the wrong location. In most cases,
an invalid protocol number is found and the dissection stops, in
other cases the wrong protocol is dissected, showing garbage.

This commit adds the following new encryption types

  IPSEC_ENCRYPT_AES_GCM_8:  "AES-GCM with 8 octet ICV [RFC4106]"
  IPSEC_ENCRYPT_AES_GCM_12: "AES-GCM with 12 octet ICV [RFC4106]"
  IPSEC_ENCRYPT_AES_GCM_16: "AES-GCM with 16 octet ICV [RFC4106]"

which are currently mapped to IPSEC_ENCRYPT_AES_GCM. In other words,
the new entries load without errors but the ICV is ignored.
The rationale is to have an unchanged reference implementation for
testing which does not bail out on the new uat encryption types.
2021-06-24 20:39:20 +00:00
John Thacker 18f6c8b058 MP2T: Only call fragment_get the first pass
Only call fragment_get() on the first pass when determining in
progress fragment length. Since we're using fragment_add_check, on
subsequent passes call fragment_get_reassembled_id(). Otherwise
dangling fragments at the end of the capture will be returned on the
second pass, causing unusual behavior and inconsistencies from the
first pass to subsequent ones.

Don't free a TVB returned from fragment_get; that can cause segfaults
when a single TSP contributes to two different reassemblies.
Also check for a too short length to prevent exceptions in cases of
dropped or out of order that would disturb the fragmentation analysis.
2021-06-24 14:34:53 -04:00
Developer Alexander 0112c9b735 pdu_transport: dissector handles registered by name
Dissector handles are registered by name so that they become accessible from
lua scripts via Dissector.get()
2021-06-24 07:39:30 +00:00
João Valverde cd05ec7232 wslog: Register log handler with GLib
This avoids having to manage two different implementations.
For example with this change GLib functions will terminate
if Wireshark's fatal log level is set to a matching level
and the --log-file option will also output messages from
GLib itself.
2021-06-24 02:31:42 +01:00
João Valverde f34cc62a6c Set the proper log domain for Qt 2021-06-24 02:30:55 +01:00
João Valverde a370024ca9 wslog: Fix initialization with invalid environment
We can't write to stderr outside of the default writer context.
Wireshark and tshark will block if we do that and dumpcap is
running as capture child.
2021-06-24 02:26:28 +01:00
João Valverde eb3417e38f wslog: Slight color and format change
This changes color use to be the very similar with GLib to
maintain familiarity. The only difference is that Message
and Info use a different color than Debug.

Also use the more familiar format of <domain> <level> instead
of <level> <domain>.
2021-06-24 00:06:19 +01:00
Gerald Combs a59501c0a3 ErlDP: Fixup some format strings.
Use G_GUINT64_FORMAT where needed.
2021-06-23 11:58:12 -07:00
João Valverde 752b0fc320 Debug: Lower priority to "noisy" for pipe spawn output
Spawn output can include very long multiline extcap arguments.
2021-06-23 17:45:44 +00:00
João Valverde 7bc3a5629e wslog: Fix crash using a custom log file
Add missing va_copy() call.
2021-06-23 17:09:24 +00:00
Andreas Schultz 8ce5618c72 ErlDP: add support for fragmented distribution messages 2021-06-23 16:58:17 +00:00
Guy Harris 6d9b0646d8 If opening a capture device provides a warning, show it.
We start the capture anyway, but print a warning message or pop up a
warning dialog first.
2021-06-23 02:31:31 -07:00
Gerald Combs cdd6f2ec80 CMake+docs: Use Asciidoctor.js if it's available.
Add the executables shipped by the Asciidoctor.js project to
FindAsciidoctor.cmake, and update the Developer's Guide to match.
2021-06-23 05:28:55 +00:00
Chuck Craft 701d0565c5 Qt: Undo MR 3422 (filter button separator hint)
See discussion attached to !3422
2021-06-23 05:12:08 +00:00
Michael Tuexen 1f0a16e472 pcapng: add support for custom options 2021-06-23 04:38:27 +00:00
John Thacker c9f4bbc11c simple_dialog(Qt): Don't warn about zero duplicate messages
Only log a warning when at least one duplicate message was actually
suppressed. Prevents "0 duplicates of %s were suppressed" messages
to the console.
2021-06-23 04:03:01 +00:00
John Thacker 784b9f44a4 NAS 5GS: Use 5GSTAI MCC/MNC fields
Use 5GS TAI (and not just TAI) where appropriate in the 5GS TAI, 5GS TAI List,
and 5GS Service Area List.
2021-06-22 21:17:14 -04:00
Uli Heilmeier b2c90bcbee sharkd: fix implicit conversion warning
With int we have a implicit conversion loses integer precision warning
2021-06-22 22:34:32 +00:00
Gerald Combs 4609bc4ad5 CMake: Mark our plugin include directories PRIVATE.
Use target_include_directories to mark our local include directories
PRIVATE, similar to what we do elsewhere.
2021-06-22 22:17:42 +00:00
Alexis La Goutte c2bcb295ac twamp: Fix extra parenthese 2021-06-22 20:30:13 +00:00
Alexis La Goutte 1ad0721c8c twamp: Fix Dead Store found by Clang Analyzer
packet-twamp.c:252:18: warning: Although the value stored to 'list' is used in the enclosing expression, the value is never actually read from 'list'
2021-06-22 20:30:13 +00:00
Alexis La Goutte 558a32ba86 dcerpc: Fix warning found by Clang Analyzer
packet-dcerpc.c:4381:17: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
2021-06-22 20:30:13 +00:00
Dario Lombardo f62138c0d5 Fix some includes. 2021-06-22 19:25:43 +00:00
Martin Mathieson 2371d2722d RDP-drdynvc: Make a variable static 2021-06-22 19:04:09 +00:00
Gerald Combs 853c438b8e WSUG: Add a note about installing a JRE.
Note that Chocolatey doesn't support altnerative package dependencies,
and that you have to install a JRE separately when installing
AscidoctorJ as a result.
2021-06-22 10:47:17 -07:00
Pascal Quantin 16f5269d54 sharkd: prevent a NULL pointer dereference (CID 1486264) 2021-06-22 16:59:03 +02:00
Pascal Quantin d317382464 sharkd: fix JSON boolean sanity check (CID 1486263) 2021-06-22 16:52:48 +02:00
Gerald Combs fe92029dd4 Docs: Remove sgml.doc.template.
It looks like we haven't used this since 2004: 556f1245e4.
2021-06-22 01:55:14 +00:00
João Valverde 2080661e88 wslog: Documentation fixups 2021-06-21 22:39:54 +01:00
João Valverde 585ddc9283 wslog: Format and color amendments 2021-06-21 22:25:47 +01:00
ZhongYao Luo 64155132ea Fix null pointer
In some cases, the fds parameter of frame_data_sequence_find is invalid,
causing the software to crash, For example, this command
echo'{"req":"frame","bytes":"yes","proto":"yes","frame":"1" }'|sharkd-
2021-06-21 18:12:45 +00:00
João Valverde 759bb234d0 wslog: Check if we are initialized and add missing inits
Instead of receiving the program name from GLib, pass it explicitly
to ws_log_init() instead  and use that to initialize the GLib program
name.

ws_log_parse_args() will now exit the program when it encounters an
argument error if exit_failure >= 0.
2021-06-21 16:03:29 +00:00
João Valverde c216bb85e7 wslog: Reverse order for level priority
Consistently speaking of ascending priority for higher levels
seems slightly more intuitive. Use that instead.
2021-06-21 16:03:29 +00:00
João Valverde b23d2f8519 wslog: Cleanup the filter/match logic 2021-06-21 16:03:29 +00:00
João Valverde 3256e45b4e wslog: Critical and error are always active.
The intention was that "error" and "critical" are *always*
active (always...). Do that.
2021-06-21 16:03:29 +00:00
João Valverde 256f5f6e30 wslog: "Warning" can also be set as fatal 2021-06-21 16:03:29 +00:00
Chuck Craft 54baebad48 Lua: reconcile expert info groups; add PI_ASSUMPTION 2021-06-21 15:27:51 +00:00
Chuck Craft a08a118d04 Qt: match Capture Options column header for snapshot length 2021-06-21 15:05:17 +00:00
Eugene Adell c3b280df8f TCP: Introduce an alternative method for the in-flight calculation.
Historically Wireshark evaluated the TCP in-flight value from the
payload actually seen all along the traffic captured.
We introduce another method to meet an observer paying greater
interest in the in-flight deduced from a ponctual SEQ analysis. It
may result in another value when analyzing incomplete conversations,
particularly when the beginning is missing.
The latter is activated by a User Preference setting added in this
release. Closes #7703.
2021-06-21 14:24:02 +00:00
Pascal Quantin 07e8e38d67 sharkd: fix compilation with gcc 11.0.1 2021-06-21 15:58:32 +02:00
Pascal Quantin 3ea51dba87 NGAP: fix dissection of multiple NGAP messages in the same HTTP2 packet
Also add dissection for more containers
2021-06-21 13:33:55 +00:00
Paul Offord 6912666568 removed reference to wsutil/ws_printf.h 2021-06-21 12:49:47 +00:00
Paul Offord 6472051771 solved code conflicts pre rebase 2021-06-21 12:49:47 +00:00
Stig Bjørlykke 553e9e83d2 Lua: Add redissect_packets()
Add Lua function redissect_packets() to redissect packets in live
capture. The use case is to reload packets after a preference change.
2021-06-21 09:52:46 +02:00