Menu

#16 Buffer overflow (READ of size 4) in the hashit() function

1.09
open
nobody
None
5
2021-04-03
2021-04-03
bsdb0y
No

Hi,

While fuzzing ATasm 1.09, I found a buffer overflow in the hashit() function, symbol.c

Attaching a reproducer, issue can be reproduced by running:

atasm hashit_test03

ATasm 1.09 (A mostly Mac65 compatible 6502 cross-assembler)
Pass 1: =================================================================
==11685==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000539110 at pc 0x0000004ee922 bp 0x7ffdfbd12830 sp 0x7ffdfbd12828
READ of size 4 at 0x000000539110 thread T0
    #0 0x4ee921 in hashit /src/atasm109/src/symbol.c:272:16
    #1 0x4ee921 in findsym /src/atasm109/src/symbol.c:303:7
    #2 0x4e8960 in do_cmd /src/atasm109/src/asm.c:1964:9
    #3 0x4e8960 in assemble /src/atasm109/src/asm.c:2009:9
    #4 0x4eb4c7 in main /src/atasm109/src/asm.c:2421:3
    #5 0x7fa66ab260b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #6 0x41c5ed in _start (/src/atasm109/src/atasm+0x41c5ed)

0x000000539110 is located 48 bytes to the left of global variable '<string literal>' defined in 'symbol.c:75:26' (0x539140) of size 7
  '<string literal>' is ascii string '=%d=%s'
0x000000539110 is located 11 bytes to the right of global variable '<string literal>' defined in 'symbol.c:73:26' (0x539100) of size 5
  '<string literal>' is ascii string '%s%s'
SUMMARY: AddressSanitizer: global-buffer-overflow /src/atasm109/src/symbol.c:272:16 in hashit
Shadow bytes around the buggy address:
  0x00008009f1d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00008009f1e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00008009f1f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00008009f200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00008009f210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x00008009f220: 05 f9[f9]f9 f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9
  0x00008009f230: 00 04 f9 f9 f9 f9 f9 f9 00 00 00 00 04 f9 f9 f9
  0x00008009f240: f9 f9 f9 f9 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9
  0x00008009f250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00008009f260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x00008009f270: 00 00 00 00 00 00 00 00 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
  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
  Shadow gap:              cc
==11685==ABORTING
1 Attachments

Discussion


Log in to post a comment.

MongoDB Logo MongoDB