Exploit-DB #42124
Description: Wireshark 2.2.0 < 2.2.12 - ROS Dissector Denial of Service
Type: dos
Platform: multiple
Date: 2017-06-05
Author: OSS-Fuzz

Exploit:
Source: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=13637

Build Information:
TShark (Wireshark) 2.3.0 (v2.3.0rc0-3235-gd97ce76161)

Copyright 1998-2017 Gerald Combs <gerald@wireshark.org> and contributors.
License GPLv2+: GNU GPL version 2 or later <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled (64-bit) with libpcap, with POSIX capabilities (Linux), with libnl 3,
with GLib 2.50.3, with zlib 1.2.11, without SMI, with c-ares 1.12.0, with Lua
5.2.4, with GnuTLS 3.5.11, with Gcrypt 1.7.6, with MIT Kerberos, with GeoIP,
with nghttp2 1.20.0, with LZ4, with Snappy, with libxml2 2.9.4.

Running on Linux 4.10.9-1-ARCH, with Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
(with SSE4.2), with 31996 MB of physical memory, with locale C, with libpcap
version 1.8.1, with GnuTLS 3.5.11, with Gcrypt 1.7.6, with zlib 1.2.11.

Built using clang 4.2.1 Compatible Clang 4.0.0 (tags/RELEASE_400/final).
--
A problem was found by the oss-fuzz project:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1216

Attached is the sample that triggers this error which can be reproduced with an
ASAN+UBSAN build of Wireshark ("tshark -Vr test.pcap").
--
epan/wmem/wmem_map.c:419:57: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/string.h:395:33: note: nonnull attribute specified here
    #0 0x7fb58924ef44 in wmem_str_hash epan/wmem/wmem_map.c:419:50
    #1 0x7fb58924c175 in wmem_map_lookup epan/wmem/wmem_map.c:252:23
    #2 0x7fb588c1e589 in ros_try_string ./asn1/ros/packet-ros-template.c:148:49
    #3 0x7fb588c1e392 in call_ros_oid_callback ./asn1/ros/packet-ros-template.c:211:13
    #4 0x7fb5887d9a35 in call_idmp_oid_callback ./asn1/idmp/packet-idmp-template.c:122:18
    #5 0x7fb5887da428 in dissect_idmp_T_result ./asn1/idmp/packet-idmp-fn.c:229:9
    #6 0x7fb585b43a53 in dissect_ber_sequence epan/dissectors/packet-ber.c:2399:17
    #7 0x7fb5887d93fb in dissect_idmp_IdmResult ./asn1/idmp/packet-idmp-fn.c:245:12
    #8 0x7fb585b4987e in dissect_ber_choice epan/dissectors/packet-ber.c:2901:21
    #9 0x7fb5887d91cd in dissect_idmp_IDM_PDU ./asn1/idmp/packet-idmp-fn.c:415:12
    #10 0x7fb5887d90dc in dissect_idmp ./asn1/idmp/packet-idmp-template.c:226:9
    #11 0x7fb587b769bb in tcp_dissect_pdus epan/dissectors/packet-tcp.c:3505:13
    #12 0x7fb5887d7b3c in dissect_idmp_tcp ./asn1/idmp/packet-idmp-template.c:244:5
    #13 0x7fb58949a0ad in call_dissector_through_handle epan/packet.c:684:8
    #14 0x7fb5894848af in call_dissector_work epan/packet.c:759:9
    #15 0x7fb5894838cd in dissector_try_uint_new epan/packet.c:1329:8
    #16 0x7fb587b78d2d in decode_tcp_ports epan/dissectors/packet-tcp.c:5430:9
    #17 0x7fb587b8420b in process_tcp_payload epan/dissectors/packet-tcp.c:5499:13
    #18 0x7fb587b7c30c in dissect_tcp_payload epan/dissectors/packet-tcp.c:5575:9
    #19 0x7fb587ba2649 in dissect_tcp epan/dissectors/packet-tcp.c:6440:13
    #20 0x7fb58949a0ad in call_dissector_through_handle epan/packet.c:684:8
    #21 0x7fb5894848af in call_dissector_work epan/packet.c:759:9
    #22 0x7fb5894838cd in dissector_try_uint_new epan/packet.c:1329:8
    #23 0x7fb5869d32ac in ip_try_dissect epan/dissectors/packet-ip.c:1854:7
    #24 0x7fb5869e2236 in dissect_ip_v4 epan/dissectors/packet-ip.c:2315:10
    #25 0x7fb58949a0ad in call_dissector_through_handle epan/packet.c:684:8
    #26 0x7fb5894848af in call_dissector_work epan/packet.c:759:9
    #27 0x7fb5894838cd in dissector_try_uint_new epan/packet.c:1329:8
    #28 0x7fb589484e09 in dissector_try_uint epan/packet.c:1353:9
    #29 0x7fb586451733 in dissect_ethertype epan/dissectors/packet-ethertype.c:267:21
    #30 0x7fb58949a0ad in call_dissector_through_handle epan/packet.c:684:8
    #31 0x7fb5894848af in call_dissector_work epan/packet.c:759:9
    #32 0x7fb5894934c7 in call_dissector_only epan/packet.c:2992:8
    #33 0x7fb58947b674 in call_dissector_with_data epan/packet.c:3005:8
    #34 0x7fb58644d90e in dissect_eth_common epan/dissectors/packet-eth.c:536:5
    #35 0x7fb586443197 in dissect_eth epan/dissectors/packet-eth.c:800:5
    #36 0x7fb58949a0ad in call_dissector_through_handle epan/packet.c:684:8
    #37 0x7fb5894848af in call_dissector_work epan/packet.c:759:9
    #38 0x7fb5894838cd in dissector_try_uint_new epan/packet.c:1329:8
    #39 0x7fb586585b27 in dissect_frame epan/dissectors/packet-frame.c:521:11
    #40 0x7fb58949a0ad in call_dissector_through_handle epan/packet.c:684:8
    #41 0x7fb5894848af in call_dissector_work epan/packet.c:759:9
    #42 0x7fb5894934c7 in call_dissector_only epan/packet.c:2992:8
    #43 0x7fb58947b674 in call_dissector_with_data epan/packet.c:3005:8
    #44 0x7fb58947a694 in dissect_record epan/packet.c:567:3
    #45 0x7fb58940ae58 in epan_dissect_run_with_taps epan/epan.c:474:2
    #46 0x564f18286ec6 in process_packet_single_pass tshark.c:3395:5
    #47 0x564f1828009e in load_cap_file tshark.c:3232:11
    #48 0x564f18277e7b in main tshark.c:1954:13
    #49 0x7fb57af42510 in __libc_start_main (/usr/lib/libc.so.6+0x20510)
    #50 0x564f18165709 in _start (run/tshark+0xd1709)

SUMMARY: AddressSanitizer: undefined-behavior epan/wmem/wmem_map.c:419:57 in


Proof of Concept:
https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/42124.zip