Commit Graph

54 Commits

Author SHA1 Message Date
Martin Mathieson 714e568f66 Fix some more spelling errors 2024-02-06 10:46:08 +00:00
John Thacker 7b114620c7 opcua: Have a default signature length preference
If the OpenSecureChannel message is not captured, then whether
messages are signed, and what the signature length is is unknown.
This creates a preference that can be set to a default value to use,
instead of assuming that all messages on the channel are unsigned.

Fix #15206
2024-02-05 08:30:57 +00:00
John Thacker d4bc9d4036 opcua: Parse more Server and Client Certificates
Even though these files are generated and warn not to change
them, the generator is not working currently, so patch them.
(See the disscussion in !14000)
2024-01-13 01:30:58 +00:00
John Thacker 9152670fe5 opcua: Use fragment_add_seq_offset
This is the reassembly API call for fragments that start at a
different value. This is better than examining the entire
chain, and also would have a better chance of working with
out of order fragments (though TCP should handle that for us.)
2024-01-12 14:18:13 +00:00
John Thacker 7ce05b9dd7 opcua: X.509 Certificate dissection
Dissect the X.509 v3 Certificates used in OPC UA.

Use proto_tree_add_bytes_with_length for adding NULL bytes to
the tree with a (0) length different than the length taken up
in the tvb. It's somewhat nicer than changing the item length later.
2024-01-11 10:30:30 -05:00
Gerhard Gappmeier 76f6b5285d opcua: fix payload size for unencrypted chunked messages
fixes #19581
also fix one typo
2024-01-11 14:37:25 +00:00
João Valverde b51a3933ba CMake: Refactor plugin add_library() macros
Replace the macro subfolder argument with type specific plugin
macros.
2023-12-14 14:18:55 +00:00
Alexis La Goutte b983decbcb opcua_application_layer: fix Dead Store found by Clang Analyzer 2023-12-14 07:17:23 +00:00
João Valverde 60f1972fa3 plugins: Fill in short description field
Fill-in the short description field for plugins that was left as
a FIXME in commit 3b59ce90c31df5d77ddd4d08ad13cb0f0e818117.

We should add a similar field for extcap extensions and Lua scripts
eventually.
2023-12-03 23:20:39 +00:00
Stig Bjørlykke 2a9bc63325 Remove init of proto variables
Remove init of proto, header field, expert info and subtree variables.
This will reduces the binary size by approximate 1266320 bytes due to
using .bss to zero-initialize the fields.

The conversion is done using the tools/convert-proto-init.py script.
2023-11-20 08:20:54 +01:00
Stig Bjørlykke 5cedcc970b plugins: Initialize static proto values to 0
Update plugins to not initialize static proto values to -1.
2023-11-07 14:32:47 +00:00
Pascal Quantin 8fc6ea3229 opcua: fix CID 1548379
Protect against a potential null pointer dereference
2023-11-02 14:43:41 +00:00
Gerhard Gappmeier f17f629870 fix return value of decrypt_opcua if decryption fails 2023-11-02 14:43:07 +00:00
Gerhard Gappmeier 3b09f561f2 opcua: add more comments 2023-10-31 21:26:47 +00:00
Gerhard Gappmeier 308336a05d opcua: add sanity check in keylog parser 2023-10-31 21:26:47 +00:00
Gerhard Gappmeier 9f17196a9d opcua: add lost sig_len parsing due to rebasing 2023-10-31 21:26:47 +00:00
Gerhard Gappmeier df8b016ea8 opcua: make strtok_r compatible with MSVC 2023-10-31 21:26:47 +00:00
Gerhard Gappmeier 3c9e7bc58b opcua: implement loading keylog file from pcapng embedded DSB 2023-10-31 21:26:47 +00:00
Gerhard Gappmeier 33b66952ac opcua: fix parsing of service payload for messages without payload
This fixes and issue reported by John Thacker.
2023-10-27 14:02:24 +00:00
Gerhard Gappmeier adaacddc48 opcua: add decryption support 2023-10-26 17:57:04 +00:00
David Perry 55db118c0f Use `register_dissector()` in plugins
Within `plugins/epan/`, change calls of `create_dissector_handle()` to
instead call `register_dissector()` with a name for the dissector.

This change allows affected dissectors to be findable by calls to
`find_dissector()`. In turn, this opens up more command-line use for
these protocols, including fuzzshark and rawshark, as well as lua use
via `Dissector.get()`.

Most changes are to sub-dissectors of the wimax plugin. For these I kept
the naming convention for dissector names used by e.g.
`wimax/msg_aas_beam.c` even though it's unwieldy.

Some of the plugins did use `register_dissector()` but with `-1` as the
protocol ID argument. I changed those to pass the actual protocol ID.

Partially addresses #5612
2023-05-02 13:48:36 -04:00
David Perry 7bc9ff3135 OpcUa: ExtensionObject.TypeId is NodeId
As per #18868, the ExtensionObject.TypeId should be parsed as a NodeId,
not as an ExpandedNodeId.
2023-04-20 08:12:38 +00:00
Matthias Isele ddb187fe0c fixes #18777 wrong decoding order in parseDiagnosticInfo 2023-01-04 10:31:24 +00:00
Martin Mathieson 709d65883f Fix some cppcheck issues 2022-11-18 10:07:57 +00:00
John Thacker 1a04473ca8 opcua: Quiet a Coverity warning
It really shouldn't be possible to have a fragment head with
no fragment items here, but quiet Coverity CID 1516904 here.
2022-11-15 17:08:53 -05:00
John Thacker 4f3b028d94 epan: Separate fragment_head and fragment_item
Separate fragment_head and fragment_item into two
different types of structs.

Remove "offset" from fragment_head, which was unused,
making fragment heads 4 bytes smaller.

Remove fragment_nr_offset, datalen, reassembled_in,
reas_in_layer_num, and error from fragment_item,
making them 24 bytes smaller.

Change a few dissectors which were using fragment_head
and fragment_item indistinguishably.

Ping #17311
2022-11-14 01:18:11 +00:00
Anders Broman 83a0ec0647 opcua: Squelch a couple of warnings by adding casts. 2022-09-07 08:19:39 +00:00
Gerald Combs 57172fe4cd CMake: Finish splitting ADD_PLUGIN_LIBRARY.
Rename add_plugin_library to add_wireshark_plugin_library and add a
backward compatibility wrapper. Make Falco Bridge a Logwolf plugin.
2022-04-04 23:10:57 +00:00
João Valverde fe5248717f Replace g_snprintf() with snprintf()
Use macros from inttypes.h with format strings.
2021-12-19 20:06:13 +00:00
cacamille3 03224385b8 Added Invalid value to BrowseDirection enum 2021-12-06 05:39:29 +00:00
Martin Mathieson a5df18e51e Fix some spelling errors 2021-10-11 04:44:49 +00:00
Evan Huus d6d7dd1e56 First pass pinfo->pool conversion
Automated find/replace of wmem_packet_scope() with pinfo->pool in all
files where it didn't cause a build failure.

I also tweaked a few of the docs which got caught up.
2021-07-21 05:38:29 +00:00
João Valverde d7401147b4 CMake: Remove non existent '/codecs' include path
The '/codecs' dir was removed in g63af1da7e7.

Avoid using include_directories(), prefer target_include_directories().
Remove some unnecessary CMAKE_CURRENT_*_DIR includes and some other
small cleanups while at it.
2021-03-29 00:00:57 +00:00
João Valverde 7f105d3981 CMake: Use CheckAPI's abort/termoutput with dissectors only
I believe this was the original intention, to use these API restricitons
with dissectors only (not that I necessarily agree with that policy either),
and through copy-paste and lack of clear guidelines it spread to other
parts of the build.

Rename the checkAPI groups to make it very clear that this is dissector-only.

This doesn't mean, of course, that good programming practices shouldn't be
followed everywhere. In particular assertions need to be used properly.
Don't use them to catch runtime errors or validate input data.

This commit will be followed by another removing the various ugly hacks
people have been using to get around the checkAPI hammer.
2021-03-01 20:59:39 +00:00
Gerald Combs 7ab6440416 Tools: Clean up checkAPI and add ui/qt.
Remove the --check-addtext and --build flags. They were used for
checkAddTextCalls, which was removed in e2735ecfdd.

Add the sources in ui/qt except for qcustomplot.{cpp,h}. Fix issues in
main.cpp, rtp_audio_stream.cpp, and wireshark_zip_helper.cpp.

Rename "index"es in packet-usb-hid.c.
2020-09-05 07:41:29 +00:00
Martin Mathieson 4f3f9ca54b Fix some spelling mistakes found among plugins. 2020-09-02 10:13:37 +01:00
Guy Harris e1d9a226a2 Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int,
not arrays of non-const pointers to const int.

Fixing that means some bugs (scribbling on what's *supposed* to be a
const array) will be caught (see packet-ieee80211-radiotap.c for
examples, the first of which inspired this change and the second of
which was discovered while testing compiles with this change), and
removes the need for some annoying casts.

Also make some of those arrays static while we're at it.

Update documentation and dissector-generator tools.

Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc
Reviewed-on: https://code.wireshark.org/review/37517
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-19 11:32:26 +00:00
Rainer Keller df1c73d68f Opcua: Fix display of GUIDs
GUIDs of the OPC UA protocol are always encoded in little endian format.
Using the default RFC4122 decoder assumes big endian and results in displaying
wrong values.

Change-Id: I0c2f60ca2f1c0ae118e8388ec58291dc0d1222b9
Reviewed-on: https://code.wireshark.org/review/34790
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2019-10-20 16:33:35 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Hannes Mezger 348f2cfd6e opcua: show invalid OPC UA messages when 'opcua' filter is set
Change-Id: Ia9d14c14c20ef35aefbb0e6b3853450074b4c0a3
Reviewed-on: https://code.wireshark.org/review/31020
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-13 06:39:22 +00:00
Hannes Mezger 3a7df1eded opcua: fix typo, use the commonly used 'Endpoint' instead of 'EndPoint'
Change-Id: I403673962987e4da0711896e8ae3e60af34acb4e
Reviewed-on: https://code.wireshark.org/review/31019
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-12 20:22:24 +00:00
Hannes Mezger 49c6f8e432 opcua: add support for new reverse hello message
The reverse hello message type was added in OPC UA specification 1.04.

Change-Id: I00095e35049b8f38ab183ded1b96af51d788d986
Reviewed-on: https://code.wireshark.org/review/31018
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-12-12 20:22:06 +00:00
Jiří Engelthaler b8b8275227 opcua: add missing opcua_nested_count decrement
Nest testing was added in I5f6da3a3e269f6db1b690b77470ddf60045bcedd as
a reaction to CVE-2018-12086. In this changed there was only nest
increment without decrement.

Bug: 15226
Change-Id: I178fad4be1106c8da23351220c95c85274bddc30
Reviewed-on: https://code.wireshark.org/review/30285
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-10-21 18:30:37 +00:00
cacamille3 e0401ad15b Updated OPC UA 1.0.4 enumeration
Change-Id: I55bd26abde59442280833973f6a6b52ba1d7b337
Reviewed-on: https://code.wireshark.org/review/30262
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-10-20 20:30:04 +00:00
cacamille3 7ca5dba864 added new OPC UA 1.04 AttributesId
Change-Id: I35963ca61792d41cf72895277e61c9fce3870200
Reviewed-on: https://code.wireshark.org/review/30234
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-17 21:30:09 +00:00
Hannes Mezger 28a7a79cac opcua: prevent opcua dissector crash by limiting nesting depth
The OPC UA types DiagnosticInfo, Variant and ExtensionObject can be
nested, which can lead to stack overflows when parsing specially
crafted packets. This is fixed by storing the current nesting depth
as expert info.
The corresponding CVE is https://cve.mitre.org/cgi-bin/cvename.cgi?name=2018-12086
The corresponding security bulletin of the OPC Foundation is https://opcfoundation-onlineapplications.org/faq/SecurityBulletins/OPC_Foundation_Security_Bulletin_CVE-2018-12086.pdf

Change-Id: I5f6da3a3e269f6db1b690b77470ddf60045bcedd
Reviewed-on: https://code.wireshark.org/review/29645
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-14 04:11:20 +00:00
Erika Szelleova 6b13c05da1 OpcUa: fix in function getExtensionObjectType
The function getExtensionObjectType was not reading the corrects bytes,
this sometimes ended in reading outside the buffer and that way
exception was raised even for correct packets.

Bug: 14465
Change-Id: I5d7d9ca5f43f0afbc93f40487a78709c52f0658a
Reviewed-on: https://code.wireshark.org/review/28328
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-06-21 03:33:21 +00:00
Dario Lombardo 4a156da068 Remove autotools build system.
It has been replaced by cmake.

Change-Id: I83a5eddb8645dbbf6bca9f026066d2e995d8e87a
Reviewed-on: https://code.wireshark.org/review/26969
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-18 03:46:17 +00:00
Dario Lombardo fe71e26af2 spdx: more licenses converted.
Change-Id: I3861061ec261e63b23621799e020e811ed78a343
Reviewed-on: https://code.wireshark.org/review/26333
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 15:56:44 +00:00
Guy Harris 459bd4646d Don't have CLEAN_FILES variables for the "clean" source files.
Except for the one directory that (currently) has "not yet clean" files,
epan/dissectors, we don't need a separate variable to keep track of the
"clean" source files.

In the cases where not all files were in CLEAN_FILES, put them into the
variable used to enable -Werror or its equivalent.

Change-Id: Ic4119861c1d9e381adfe31e9977e1ac71d623f5b
Reviewed-on: https://code.wireshark.org/review/25830
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-17 02:50:24 +00:00