Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2019-14274: mcpp / Bugs / #13 Multiple Heap-based Buffer Overflow in the do_msg() function

MCPP 2.7.2 has a heap-based buffer overflow in the do_msg() function in support.c.

CVE
#buffer_overflow

Hi,

While fuzzing mcpp with American Fuzzy Lop, I found two Heap-based
Buffer Overflow in the do_msg() function, in support.c L2514 and L2466.

Attaching reproducers, issues can be reproduced by running:

mcpp test-do_msg01
mcpp test-do_msg02

Regards,
Frederic Cambus.

=================================================================
==10413==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000001d8 at pc 0x00000055ca6a bp 0x7fffb81dfbf0 sp 0x7fffb81dfbe8
WRITE of size 1 at 0x6020000001d8 thread T0
#0 0x55ca69 in do_msg /home/fcambus/mcpp-2.7.2/src/support.c:2514:23
#1 0x54eed9 in cerror /home/fcambus/mcpp-2.7.2/src/support.c:2633:5
#2 0x553456 in scan_quote /home/fcambus/mcpp-2.7.2/src/support.c:867:21
#3 0x55a22e in parse_line /home/fcambus/mcpp-2.7.2/src/support.c:1758:22
#4 0x550214 in get_ch /home/fcambus/mcpp-2.7.2/src/support.c:1580:13
#5 0x513c1b in mcpp_main /home/fcambus/mcpp-2.7.2/src/main.c:626:17
#6 0x513396 in main /home/fcambus/mcpp-2.7.2/src/main.c:421:5
#7 0x7f2b6ef38b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/…/csu/libc-start.c:310
#8 0x41a149 in _start (/home/fcambus/mcpp-verif/mcpp+0x41a149)

0x6020000001d8 is located 0 bytes to the right of 8-byte region [0x6020000001d0,0x6020000001d8)
allocated by thread T0 here:
#0 0x4da000 in malloc (/home/fcambus/mcpp-verif/mcpp+0x4da000)
#1 0x55c21b in do_msg /home/fcambus/mcpp-2.7.2/src/support.c:2459:35
#2 0x54eed9 in cerror /home/fcambus/mcpp-2.7.2/src/support.c:2633:5
#3 0x553456 in scan_quote /home/fcambus/mcpp-2.7.2/src/support.c:867:21
#4 0x55a22e in parse_line /home/fcambus/mcpp-2.7.2/src/support.c:1758:22
#5 0x550214 in get_ch /home/fcambus/mcpp-2.7.2/src/support.c:1580:13
#6 0x513c1b in mcpp_main /home/fcambus/mcpp-2.7.2/src/main.c:626:17
#7 0x513396 in main /home/fcambus/mcpp-2.7.2/src/main.c:421:5
#8 0x7f2b6ef38b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/…/csu/libc-start.c:310

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fcambus/mcpp-2.7.2/src/support.c:2514:23 in do_msg
Shadow bytes around the buggy address:
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 06 fa fa fd fd fa fa 00 07 fa fa fd fa
0x0c047fff8010: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c047fff8020: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
=>0x0c047fff8030: fa fa fd fa fa fa fd fa fa fa 00[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
0x0c047fff8080: 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
==10413==ABORTING

=================================================================
==10415==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000000f2 at pc 0x00000055c3ad bp 0x7ffd32cbaa30 sp 0x7ffd32cbaa28
READ of size 1 at 0x6020000000f2 thread T0
#0 0x55c3ac in do_msg /home/fcambus/mcpp-2.7.2/src/support.c:2466:21
#1 0x54f169 in cwarn /home/fcambus/mcpp-2.7.2/src/support.c:2647:5
#2 0x5524c1 in scan_quote /home/fcambus/mcpp-2.7.2/src/support.c:765:25
#3 0x55a22e in parse_line /home/fcambus/mcpp-2.7.2/src/support.c:1758:22
#4 0x550214 in get_ch /home/fcambus/mcpp-2.7.2/src/support.c:1580:13
#5 0x513c1b in mcpp_main /home/fcambus/mcpp-2.7.2/src/main.c:626:17
#6 0x513396 in main /home/fcambus/mcpp-2.7.2/src/main.c:421:5
#7 0x7f9fb21ebb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/…/csu/libc-start.c:310
#8 0x41a149 in _start (/home/fcambus/mcpp-verif/mcpp+0x41a149)

0x6020000000f2 is located 0 bytes to the right of 2-byte region [0x6020000000f0,0x6020000000f2)
allocated by thread T0 here:
#0 0x4da000 in malloc (/home/fcambus/mcpp-verif/mcpp+0x4da000)
#1 0x556ae4 in xmalloc /home/fcambus/mcpp-2.7.2/src/support.c:2336:28
#2 0x552409 in scan_quote /home/fcambus/mcpp-2.7.2/src/support.c:762:31
#3 0x55a22e in parse_line /home/fcambus/mcpp-2.7.2/src/support.c:1758:22
#4 0x550214 in get_ch /home/fcambus/mcpp-2.7.2/src/support.c:1580:13
#5 0x513c1b in mcpp_main /home/fcambus/mcpp-2.7.2/src/main.c:626:17
#6 0x513396 in main /home/fcambus/mcpp-2.7.2/src/main.c:421:5
#7 0x7f9fb21ebb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/…/csu/libc-start.c:310

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fcambus/mcpp-2.7.2/src/support.c:2466:21 in do_msg
Shadow bytes around the buggy address:
0x0c047fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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 06 fa fa fd fd fa fa 00 07 fa fa fd fa
=>0x0c047fff8010: fa fa fd fa fa fa fd fa fa fa fd fa fa fa[02]fa
0x0c047fff8020: fa fa 02 fa fa fa fa fa fa fa fa fa fa fa fa fa
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
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
==10415==ABORTING

2 Attachments

Related news

Gentoo Linux Security Advisory 202208-04

Gentoo Linux Security Advisory 202208-4 - Multiple vulnerabilities in libmcpp could result in a denial of service condition. Versions less than 2.7.2_p5 are affected.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda