Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASan: heap-buffer-overflow nfdump/bin/nffile_inline.c:191 in ExpandRecord_v2 #177

Closed
fgeek opened this issue Aug 4, 2019 · 1 comment

Comments

@fgeek
Copy link

commented Aug 4, 2019

Tested commit: 0b45172
Credits: Henri Salo
Tools: american fuzzy lop 2.53b, afl-utils
005-nfcapd.txt (7050619c853e3a43de69daa5048d2a74b9b76658)

./nfdump -r 005-nfcapd.txt
Date first seen          Duration Proto      Src IP Addr:Port          Dst IP Addr:Port   Packets    Bytes Flows
Verify map id 0: ERROR: Expected 1 elements in map, but found 2!
=================================================================
==19540==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000017c at pc 0x5581763db18a bp 0x7ffe4747faf0 sp 0x7ffe4747fae8
READ of size 2 at 0x60200000017c thread T0
    #0 0x5581763db189 in ExpandRecord_v2 /home/afl/src/nfdump/bin/nffile_inline.c:191
    #1 0x5581763db189 in process_data /home/afl/src/nfdump/bin/nfdump.c:579
    #2 0x5581763db189 in main /home/afl/src/nfdump/bin/nfdump.c:1213
    #3 0x7f6a24ff709a in __libc_start_main ../csu/libc-start.c:308
    #4 0x5581763dc499 in _start (/home/afl/builds/nfdump/0b45172134d354081d80212cb33e224a46c48298/bin/nfdump+0x1a499)

0x60200000017c is located 0 bytes to the right of 12-byte region [0x602000000170,0x60200000017c)
allocated by thread T0 here:
    #0 0x7f6a253fe330 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f6a25276136 in Insert_Extension_Map /home/afl/src/nfdump/bin/nfx.c:262

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/afl/src/nfdump/bin/nffile_inline.c:191 in ExpandRecord_v2
Shadow bytes around the buggy address:
  0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c047fff8000: fa fa 00 07 fa fa 02 fa fa fa 02 fa fa fa 02 fa
  0x0c047fff8010: fa fa 05 fa fa fa 02 fa fa fa 02 fa fa fa 02 fa
=>0x0c047fff8020: fa fa fd fa fa fa 00 fa fa fa 04 fa fa fa 00[04]
  0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8070: 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
==19540==ABORTING
$ hexdump -C 005-nfcapd.txt
00000000  0c a5 01 00 00 30 30 30  30 30 30 30 30 30 30 30  |.....00000000000|
00000010  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  |0000000000000000|
*
00000110  30 30 30 30 30 30 30 30  30 00 00 00 02 00 30 30  |000000000.....00|
00000120  02 00 0c 00 00 00 30 30  0b 00 30 00 0a 00 30 00  |......00..0...0.|
00000130  30 30 00 00 30 30 30 30  30 30 30 30 30 30 30 30  |00..000000000000|
00000140  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  |0000000000000000|
00000150
phaag pushed a commit that referenced this issue Aug 5, 2019
@phaag

This comment has been minimized.

Copy link
Owner

commented Aug 5, 2019

Fixed in 76dfc7d.
Thanks for reporting.

@phaag phaag closed this Aug 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.