Bug 11791 - Wireshark stack-based out-of-bounds read in find_signature
Summary: Wireshark stack-based out-of-bounds read in find_signature
Status: RESOLVED FIXED
Alias: None
Product: Wireshark
Classification: Unclassified
Component: Capture file support (libwiretap) (show other bugs)
Version: Git
Hardware: All All
: Low Major (vote)
Target Milestone: ---
Assignee: Bugzilla Administrator
URL:
Depends on:
Blocks:
 
Reported: 2015-11-27 16:01 UTC by Mateusz Jurczyk
Modified: 2016-02-05 20:43 UTC (History)
1 user (show)

See Also:


Attachments
Reproducers. (36.76 KB, application/zip)
2015-11-27 16:01 UTC, Mateusz Jurczyk
Details
unzip file 1 (367.07 KB, application/octet-stream)
2015-11-29 00:08 UTC, Michael Mann
Details
unzip file 2 (65.36 KB, application/octet-stream)
2015-11-29 00:09 UTC, Michael Mann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz Jurczyk 2015-11-27 16:01:15 UTC
Created attachment 14046 [details]
Reproducers.

Build Information:
Wireshark git master.
--
The following crash due to a stack-based out-of-bounds read can be observed in an ASAN build of Wireshark (current git master), by feeding a malformed file to tshark ("$ ./tshark -nVxr /path/to/file"):

Attached are two files which trigger the crash.

--- cut ---
==3901==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffeadbc852d at pc 0x0000009cea23 bp 0x7ffeadbbf650 sp 0x7ffeadbbf648
READ of size 1 at 0x7ffeadbc852d thread T0
    #0 0x9cea22 in find_signature wireshark/wiretap/vwr.c:2214:17
    #1 0x9c5066 in vwr_read_s2_s3_W_rec wireshark/wiretap/vwr.c:1435:15
    #2 0x9bc02a in vwr_process_rec_data wireshark/wiretap/vwr.c:2336:20
    #3 0x9babf2 in vwr_read wireshark/wiretap/vwr.c:653:10
    #4 0x9d64c2 in wtap_read wireshark/wiretap/wtap.c:1314:7
    #5 0x535c1a in load_cap_file wireshark/tshark.c:3479:12
    #6 0x52c1df in main wireshark/tshark.c:2197:13

Address 0x7ffeadbc852d is located in stack of thread T0 at offset 32813 in frame
    #0 0x9bbbcf in vwr_process_rec_data wireshark/wiretap/vwr.c:2320

  This frame has 1 object(s):
    [32, 32800) 'rec' <== Memory access at offset 32813 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow wireshark/wiretap/vwr.c:2214:17 in find_signature
Shadow bytes around the buggy address:
  0x100055b71050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b71060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b71070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b71080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b71090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x100055b710a0: 00 00 00 00 f3[f3]f3 f3 f3 f3 f3 f3 f3 f3 f3 f3
  0x100055b710b0: f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3
  0x100055b710c0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b710d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b710e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100055b710f0: f1 f1 f1 f1 04 f2 04 f3 00 00 00 00 00 00 00 00
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
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  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
==3901==ABORTING
--- cut ---

This bug is subject to a 90 day disclosure deadline. If 90 days elapse without a broadly available patch, then the bug report will automatically become visible to the public.
Comment 1 Michael Mann 2015-11-29 00:08:58 UTC
Created attachment 14070 [details]
unzip file 1
Comment 2 Michael Mann 2015-11-29 00:09:23 UTC
Created attachment 14071 [details]
unzip file 2

Unzip files for the fuzzbots
Comment 3 Michael Mann 2015-11-29 00:09:56 UTC
Make public so the Gerrit hooks work.
Comment 4 Gerrit Code Review 2015-11-29 00:10:20 UTC
Change 12270 had a related patch set uploaded by Michael Mann:
Add bounds checking to find_signature.

https://code.wireshark.org/review/12270
Comment 5 Gerrit Code Review 2015-11-29 22:00:49 UTC
Change 12270 merged by Michael Mann:
Add bounds checking to find_signature.

https://code.wireshark.org/review/12270
Comment 6 Gerrit Code Review 2015-11-29 22:01:03 UTC
Change 12294 had a related patch set uploaded by Michael Mann:
Add bounds checking to find_signature.

https://code.wireshark.org/review/12294
Comment 7 Gerrit Code Review 2015-11-29 22:01:11 UTC
Change 12294 merged by Michael Mann:
Add bounds checking to find_signature.

https://code.wireshark.org/review/12294
Comment 8 Gerrit Code Review 2015-11-29 22:01:31 UTC
Change 12295 had a related patch set uploaded by Michael Mann:
Add bounds checking to find_signature.

https://code.wireshark.org/review/12295
Comment 9 Gerrit Code Review 2015-11-29 22:01:39 UTC
Change 12295 merged by Michael Mann:
Add bounds checking to find_signature.

https://code.wireshark.org/review/12295
Comment 10 Gerrit Code Review 2016-02-05 20:43:30 UTC
Change 13767 had a related patch set uploaded by Balint Reczey:
Add bounds checking to find_signature.

https://code.wireshark.org/review/13767
Comment 11 Gerrit Code Review 2016-02-05 20:43:41 UTC
Change 13767 merged by Balint Reczey:
Add bounds checking to find_signature.

https://code.wireshark.org/review/13767