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

heap-buffer-overflow (WRITE of size 1) in sdb_json_indent and doIndent #150

Closed
geeknik opened this issue Apr 10, 2018 · 1 comment
Closed

Comments

@geeknik
Copy link

geeknik commented Apr 10, 2018

While testing sdb ( 85eeb0e), I was able to trigger a heap-buffer-overflow in sdb_json_indent with a simple JSON file: test002.json.gz

./sdb - < test002.json

==8501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000000051 at pc 0x000000509ea0 bp 0x7ffc06785d60 sp 0x7ffc06785d58
WRITE of size 1 at 0x603000000051 thread T0
    #0 0x509e9f in sdb_json_indent /root/sdb/src/./json/indent.c:104:5
    #1 0x514646 in sdb_querys /root/sdb/src/query.c:790:16
    #2 0x51233b in sdb_query /root/sdb/src/query.c:840:8
    #3 0x4ee616 in main /root/sdb/src/main.c:496:13
    #4 0x7fbf583121c0 in __libc_start_main /build/glibc-itYbWN/glibc-2.26/csu/../csu/libc-start.c:308
    #5 0x41aa39 in _start (/root/sdb/src/sdb+0x41aa39)

0x603000000051 is located 0 bytes to the right of 17-byte region [0x603000000040,0x603000000051)
allocated by thread T0 here:
    #0 0x4c0a33 in malloc /b/build/slave/linux_upload_clang/build/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cc:88:3
    #1 0x508f8b in sdb_json_indent /root/sdb/src/./json/indent.c:53:6

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/sdb/src/./json/indent.c:104:5 in sdb_json_indent

During the same testing period, I was also able to trigger a similar heap-buffer-overflow in another part of the code called doIndent with this file: test005.json.gz

./sdb - < test005.json

==20513==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000005a at pc 0x000000509eb8 bp 0x7ffd9af5e780 sp 0x7ffd9af5e778
WRITE of size 1 at 0x60300000005a thread T0
    #0 0x509eb7 in doIndent /root/sdb/src/./json/indent.c:10:12
    #1 0x509eb7 in sdb_json_indent /root/sdb/src/./json/indent.c:90
    #2 0x514646 in sdb_querys /root/sdb/src/query.c:790:16
    #3 0x51233b in sdb_query /root/sdb/src/query.c:840:8
    #4 0x4ee616 in main /root/sdb/src/main.c:496:13
    #5 0x7fc32dbd31c0 in __libc_start_main /build/glibc-itYbWN/glibc-2.26/csu/../csu/libc-start.c:308
    #6 0x41aa39 in _start (/root/sdb/src/sdb+0x41aa39)

0x60300000005a is located 0 bytes to the right of 26-byte region [0x603000000040,0x60300000005a)
allocated by thread T0 here:
    #0 0x4c0a33 in malloc /b/build/slave/linux_upload_clang/build/src/third_party/llvm/compiler-rt/lib/asan/asan_malloc_linux.cc:88:3
    #1 0x508f8b in sdb_json_indent /root/sdb/src/./json/indent.c:53:6

SUMMARY: AddressSanitizer: heap-buffer-overflow /root/sdb/src/./json/indent.c:10:12 in doIndent
@radare radare closed this as completed in cf4538f Apr 10, 2018
@radare
Copy link
Collaborator

radare commented Apr 10, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants