Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • wireshark wireshark
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 1.4k
    • Issues 1.4k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 178
    • Merge requests 178
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Wireshark FoundationWireshark Foundation
  • wiresharkwireshark
  • Issues
  • #17755
Closed
Open
Issue created Nov 30, 2021 by Shaohua Li@shao-hua-li

heap-buffer-overflow in pcapng_process_options

Summary

A heap-buffer-overflow occurred when I was fuzzing tshark -nVxr.

AddressSanitizer report:

==164236==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c000001820 at pc 0x55d949587a9f bp 0x7fffc55f70d0 sp 0x7fffc55f70c8
READ of size 2 at 0x60c000001820 thread T0
    #0 0x55d949587a9e in pcapng_process_options (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb97ba9e)
    #1 0x55d9495a11a6 in pcapng_read_packet_block pcapng.c
    #2 0x55d949593bda in pcapng_read_block pcapng.c
    #3 0x55d94958f8fd in pcapng_read pcapng.c
    #4 0x55d94927bebe in wtap_read (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb66febe)
    #5 0x55d949132828 in process_cap_file_single_pass tshark.c
    #6 0x55d949128aab in process_cap_file tshark.c
    #7 0x55d94911fe2e in main (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb513e2e)
    #8 0x7f5cd36c40b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
    #9 0x55d9490682ad in _start (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb45c2ad)

0x60c000001820 is located 32 bytes to the right of 128-byte region [0x60c000001780,0x60c000001800)
allocated by thread T0 here:
    #0 0x55d9490e4a5d in malloc (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb4d8a5d)
    #1 0x55d949587793 in pcapng_process_options (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb97b793)
    #2 0x55d9495a11a6 in pcapng_read_packet_block pcapng.c
    #3 0x55d949593bda in pcapng_read_block pcapng.c
    #4 0x55d94958f8fd in pcapng_read pcapng.c
    #5 0x55d94927bebe in wtap_read (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb66febe)
    #6 0x55d949132828 in process_cap_file_single_pass tshark.c
    #7 0x55d949128aab in process_cap_file tshark.c
    #8 0x55d94911fe2e in main (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb513e2e)
    #9 0x7f5cd36c40b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: heap-buffer-overflow (/shared/targets/wireshark/analysis/debug/asan/clang-default/CMakeBuild/run/tshark+0xb97ba9e) in pcapng_process_options
Shadow bytes around the buggy address:
  0x0c187fff82b0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x0c187fff82c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c187fff82d0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c187fff82e0: 00 00 00 00 00 00 01 fa fa fa fa fa fa fa fa fa
  0x0c187fff82f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c187fff8300: fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa
  0x0c187fff8310: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c187fff8320: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c187fff8330: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c187fff8340: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c187fff8350: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==164236==ABORTING

Steps to reproduce

  • Compiler : clang13

  • Reproduce: run ./run/tshark -nVxr heap_buffer_overflow_pcapng_process_options.pcap

Sample capture file

heap_buffer_overflow_pcapng_process_options.pcap

Build information

Compiled (64-bit) using Clang 13.0.1, with libpcap, without POSIX capabilities,
without libnl, with GLib 2.64.6, with PCRE2, with zlib 1.2.11, without Lua,
without GnuTLS, with Gcrypt 1.8.5, without Kerberos, without MaxMind DB
resolver, without nghttp2, without brotli, without LZ4, without Zstandard,
without Snappy, with libxml2 2.9.10, without libsmi.

Running on Linux 5.4.0-91-generic, with AMD Ryzen Threadripper 3990X 64-Core
Processor (with SSE4.2), with 257675 MB of physical memory, with GLib 2.64.6,
with PCRE2 10.34 2019-11-21, with zlib 1.2.11, with libpcap 1.9.1 (with
TPACKET_V3), with c-ares 1.15.0, with Gcrypt 1.8.5, with LC_TYPE=C, binary
plugins supported (0 loaded).
Edited Nov 30, 2021 by Shaohua Li
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking