Headline
CVE-2023-41000: Null Pointer Dereference in function BS_ReadByte · Issue #2550 · gpac/gpac
GPAC through 2.2.1 has a use-after-free vulnerability in the function gf_bifs_flush_command_list in bifs/memory_decoder.c.
Thanks for your reply
Yeah, there’s something wrong with my sanitizer, correct reporting is a use-after-free issue as follows
==57372==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000001030 at pc 0x7f6bf19b9154 bp 0x7ffd09243090 sp 0x7ffd09243088
READ of size 4 at 0x603000001030 thread T0
#0 0x7f6bf19b9153 in gf_bifs_flush_command_list (/usr/local/lib/libgpac.so.12+0x135a153)
#1 0x7f6bf19b94be in gf_bifs_decode_command_list (/usr/local/lib/libgpac.so.12+0x135a4be)
#2 0x7f6bf21f5d05 in gf_sm_load_run_isom (/usr/local/lib/libgpac.so.12+0x1b96d05)
#3 0x51eea8 in dump_isom_scene /root/fuzz_pro/fuzz_gpac/gpac/applications/mp4box/filedump.c:209:14
#4 0x50a1df in mp4box_main /root/fuzz_pro/fuzz_gpac/gpac/applications/mp4box/mp4box.c:6461:7
#5 0x7f6bf0359d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
#6 0x7f6bf0359e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
#7 0x42fcf4 in _start (/usr/local/bin/MP4Box+0x42fcf4)
0x603000001030 is located 0 bytes inside of 24-byte region [0x603000001030,0x603000001048)
freed by thread T0 here:
#0 0x4ac972 in __interceptor_free (/usr/local/bin/MP4Box+0x4ac972)
#1 0x7f6bf1529ad5 in gf_sg_command_del (/usr/local/lib/libgpac.so.12+0xecaad5)
#2 0x7f6bf19b189c in BM_ParseInsert (/usr/local/lib/libgpac.so.12+0x135289c)
#3 0x7f6bf19b7be6 in BM_ParseCommand (/usr/local/lib/libgpac.so.12+0x1358be6)
#4 0x7f6bf19b8336 in gf_bifs_flush_command_list (/usr/local/lib/libgpac.so.12+0x1359336)
#5 0x7f6bf19b94be in gf_bifs_decode_command_list (/usr/local/lib/libgpac.so.12+0x135a4be)
#6 0x7f6bf21f5d05 in gf_sm_load_run_isom (/usr/local/lib/libgpac.so.12+0x1b96d05)
#7 0x51eea8 in dump_isom_scene /root/fuzz_pro/fuzz_gpac/gpac/applications/mp4box/filedump.c:209:14
#8 0x50a1df in mp4box_main /root/fuzz_pro/fuzz_gpac/gpac/applications/mp4box/mp4box.c:6461:7
#9 0x7f6bf0359d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
previously allocated by thread T0 here:
#0 0x4acbdd in malloc (/usr/local/bin/MP4Box+0x4acbdd)
#1 0x7f6bf174e467 in gf_sg_vrml_field_pointer_new (/usr/local/lib/libgpac.so.12+0x10ef467)
#2 0x7f6bf19b12ab in BM_ParseInsert (/usr/local/lib/libgpac.so.12+0x13522ab)
#3 0x7f6bf19b7be6 in BM_ParseCommand (/usr/local/lib/libgpac.so.12+0x1358be6)
#4 0x7f6bf19b8336 in gf_bifs_flush_command_list (/usr/local/lib/libgpac.so.12+0x1359336)
#5 0x7f6bf19b94be in gf_bifs_decode_command_list (/usr/local/lib/libgpac.so.12+0x135a4be)
#6 0x7f6bf21f5d05 in gf_sm_load_run_isom (/usr/local/lib/libgpac.so.12+0x1b96d05)
#7 0x51eea8 in dump_isom_scene /root/fuzz_pro/fuzz_gpac/gpac/applications/mp4box/filedump.c:209:14
#8 0x50a1df in mp4box_main /root/fuzz_pro/fuzz_gpac/gpac/applications/mp4box/mp4box.c:6461:7
#9 0x7f6bf0359d8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
SUMMARY: AddressSanitizer: heap-use-after-free (/usr/local/lib/libgpac.so.12+0x135a153) in gf_bifs_flush_command_list
Shadow bytes around the buggy address:
0x0c067fff81b0: fa fa 00 00 00 01 fa fa 00 00 04 fa fa fa fd fd
0x0c067fff81c0: fd fd fa fa 00 00 04 fa fa fa 00 00 00 fa fa fa
0x0c067fff81d0: 00 00 00 01 fa fa 00 00 04 fa fa fa fd fd fd fd
0x0c067fff81e0: fa fa 00 00 04 fa fa fa 00 00 00 00 fa fa 00 00
0x0c067fff81f0: 00 00 fa fa 00 00 00 00 fa fa 00 00 00 00 fa fa
=>0x0c067fff8200: 00 00 00 00 fa fa[fd]fd fd fa fa fa fd fd fd fa
0x0c067fff8210: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
0x0c067fff8220: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
0x0c067fff8230: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
0x0c067fff8240: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fa fa
0x0c067fff8250: 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
==57372==ABORTING