4 heap-buffer-overflow in MP4Box in gpac/gpac

Valid

Reported on

Oct 11th 2023


Description

4 heap-buffer-overflow in MP4Box

Version

$ ./MP4Box -version
MP4Box - GPAC version 2.3-DEV-rev566-g50c2ab06f-master

Platform

$ uname -a
Linux user-GE40-2PC-Dragon-Eyes 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep  7 10:33:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Reproduce

./MP4Box -dash 10000 poc

Credit

Gandalf4a

Impact

This vulnerability allows a remote attacker to cause a denial of service or even arbitrary code execution on an affected gpac MP4Box. Exploiting this vulnerability requires user interaction, as the target must access a malicious page or open a malicious file.

Occurrences

heap-buffer-overflow in /gpac/src/filters/reframe_mhas.c:545:8 in mhas_dmx_process

poc

https://github.com/gandalf4a/crash_report/blob/main/gpac/MP4Box/poc2/hbo_545

asan

[32m[Dasher] No template assigned, using $File$_dash$FS$$Number$
[0m[33m[RFC6381] Cannot find MPEG-H Audio Config or audio PL, defaulting to profile 0x01
[0m[33m[MHASDmx] MHAS packet with 0 payload size, considering sync was lost
[0m=================================================================
==725111==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62500001b758 at pc 0x7fa175a2bcc1 bp 0x7ffeee026090 sp 0x7ffeee026088
READ of size 1 at 0x62500001b758 thread T0
    #0 0x7fa175a2bcc0 in mhas_dmx_process /home/user/fuzzing_gpac/gpac/src/filters/reframe_mhas.c:545:8
    #1 0x7fa1755afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7
    #2 0x7fa17557d47b in gf_fs_thread_proc /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2105:3
    #3 0x7fa17557b5cf in gf_fs_run /home/user/fuzzing_gpac/gpac/src/filter_core/filter_session.c:2405:3
    #4 0x7fa174e2ac6a in gf_dasher_process /home/user/fuzzing_gpac/gpac/src/media_tools/dash_segmenter.c:1236:6
    #5 0x56237ce866dc in do_dash /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:4831:15
    #6 0x56237ce77b6e in mp4box_main /home/user/fuzzing_gpac/gpac/applications/mp4box/mp4box.c:6245:7
    #7 0x7fa173e29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #8 0x7fa173e29e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #9 0x56237cd9fdd4 in _start (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x82dd4) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)

0x62500001b758 is located 0 bytes to the right of 9816-byte region [0x625000019100,0x62500001b758)
allocated by thread T0 here:
    #0 0x56237ce23046 in __interceptor_realloc (/home/user/fuzzing_gpac/gpac/bin/gcc/MP4Box+0x106046) (BuildId: 53333ca7bff59dd9a3d1b2821e7c5f3a9aac76b9)
    #1 0x7fa175a293f4 in mhas_dmx_process /home/user/fuzzing_gpac/gpac/src/filters/reframe_mhas.c:510:23
    #2 0x7fa1755afa33 in gf_filter_process_task /home/user/fuzzing_gpac/gpac/src/filter_core/filter.c:2971:7

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/user/fuzzing_gpac/gpac/src/filters/reframe_mhas.c:545:8 in mhas_dmx_process
Shadow bytes around the buggy address:
  0x0c4a7fffb690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb6a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb6b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb6c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4a7fffb6d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c4a7fffb6e0: 00 00 00 00 00 00 00 00 00 00 00[fa]fa fa fa fa
  0x0c4a7fffb6f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a7fffb730: 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
==725111==ABORTING
We are processing your report and will contact the gpac team within 24 hours. 4 months ago
A GitHub Issue asking the maintainers to create a SECURITY.md exists 4 months ago
We have contacted a member of the gpac team and are waiting to hear back 4 months ago
gpac/gpac maintainer
4 months ago

https://github.com/gpac/gpac/issues/2635

gpac/gpac maintainer modified the Severity from Medium (6.8) to Medium (5.1) 4 months ago
The researcher has received a minor penalty to their credibility for miscalculating the severity: -1
gpac/gpac maintainer validated this vulnerability 4 months ago
gandalf4a has been awarded the disclosure bounty
The fix bounty is now up for grabs
The researcher's credibility has increased: +7
gpac/gpac maintainer marked this as fixed in 2.3.0-DEV with commit 52cd40 4 months ago
The fix bounty has been dropped
This vulnerability has now been published 4 months ago
reframe_mhas.c#L545 has been validated
gandalf4a
4 months ago

Researcher


Can this vulnerability be applied for cve? @admin

Ben Harvie
4 months ago

Admin


CVE assignment is the maintainers decision, if we can get confirmation from them I can assign a CVE. Thanks!

gandalf4a
4 months ago

Researcher


The maintainers didn't seem to know how to do it, they were confirmed directly in the github issue(https://github.com/gpac/gpac/issues/2635). Can we assign a CVE through this? Thanks! @admin

to join this conversation