pdfalto
pdfalto copied to clipboard
heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0xc717c) in strncat
hi,
I find bug, heap-buffer-overflow
in 499ed89
gcc --version:
➜ 1 git:(master) ✗ gcc --version
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
os & kernel :
➜ 1 git:(master) ✗ uname -r
5.4.0-37-generic
➜ 1 git:(master) ✗ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
command line: ./pdfalto -f 1 ~/Desktop/pdfalto/small.pdf
poc:
poc.zip
log:
➜ pdfalto git:(master) ✗ ./pdfalto -f 1 ~/Desktop/pdfalto/small.pdf
/home/lin/pdfalto/pdfalto, 18
=================================================================
==2515089==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000000052 at pc 0x7ffa86c6917d bp 0x7ffdb915e560 sp 0x7ffdb915dd08
WRITE of size 18 at 0x603000000052 thread T0
#0 0x7ffa86c6917c in strncat (/lib/x86_64-linux-gnu/libasan.so.5+0xc717c)
#1 0x40e04e in main /home/lin/pdfalto/src/pdfalto.cc:191
#2 0x7ffa868820b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#3 0x408bfd in _start (/home/lin/pdfalto/pdfalto+0x408bfd)
0x603000000052 is located 0 bytes to the right of 18-byte region [0x603000000040,0x603000000052)
allocated by thread T0 here:
#0 0x7ffa86cafbc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x40dfd8 in main /home/lin/pdfalto/src/pdfalto.cc:189
#2 0x7ffa868820b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/lib/x86_64-linux-gnu/libasan.so.5+0xc717c) in strncat
Shadow bytes around the buggy address:
0x0c067fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c067fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c067fff8000: fa fa 00 00 00 02 fa fa 00 00[02]fa fa fa fa fa
0x0c067fff8010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c067fff8050: 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
Shadow gap: cc
==2515089==ABORTING
Thanks !