Stack buffer overflow in RTSP packet parsing in gpac/gpac


Reported on

May 1st 2022


A malicious RTSP server can trigger a stack buffer overflow via an RTSP packet with an excessively long content-length due to no bounds check when copying into a fixed sized buffer.

Proof of Concept is available here

(terminal 1)

python3 31337

(terminal 2)

./configure --enable-sanitizer
make -j32
./bin/gcc/gpac -play rtsp://
ietf/rtsp_common.c:86:7: runtime error: index 30 out of bounds for type 'char [30]'


Thread 1 "gpac" received signal SIGABRT, Aborted.
0x00007ffff749d34c in __pthread_kill_implementation () from /usr/lib/
(gdb) bt
#0  0x00007ffff749d34c in __pthread_kill_implementation () at /usr/lib/
#1  0x00007ffff74504b8 in raise () at /usr/lib/
#2  0x00007ffff743a534 in abort () at /usr/lib/
#3  0x00007ffff7491397 in __libc_message () at /usr/lib/
#4  0x00007ffff75302fa in __fortify_fail () at /usr/lib/
#5  0x00007ffff75302c6 in  () at /usr/lib/
#6  0x00007ffff780e9c9 in  () at /gpac/bin/gcc/
#7  0x00007ffff780eaf8 in gf_rtsp_read_reply () at /gpac/bin/gcc/
#8  0x00007ffff7810cb5 in gf_rtsp_get_response () at /gpac/bin/gcc/
#9  0x00007ffff7bda785 in rtpin_rtsp_process_commands () at /gpac/bin/gcc/
#10 0x00007ffff7bd9bb6 in rtpin_process () at /gpac/bin/gcc/
#11 0x00007ffff7b3abb5 in gf_filter_process_task () at /gpac/bin/gcc/
#12 0x00007ffff7b281f7 in gf_fs_thread_proc () at /gpac/bin/gcc/
#13 0x00007ffff7b2d1ab in gf_fs_run () at /gpac/bin/gcc/
#14 0x0000555555563a7f in gpac_main ()
#15 0x00007ffff743b310 in __libc_start_call_main () at /usr/lib/
#16 0x00007ffff743b3c1 in __libc_start_main_impl () at /usr/lib/
#17 0x0000555555559dc5 in _start ()


This is capable of causing crashes and allowing modification of stack memory which could lead to remote code execution.

We are processing your report and will contact the gpac team within 24 hours. 2 months ago
We have contacted a member of the gpac team and are waiting to hear back 2 months ago
gpac/gpac maintainer
2 months ago


We have sent a follow up to the gpac team. We will try again in 7 days. 2 months ago
We have sent a second follow up to the gpac team. We will try again in 10 days. a month ago
gpac/gpac maintainer validated this vulnerability a month ago
Callum Thomson has been awarded the disclosure bounty
The fix bounty is now up for grabs
The researcher's credibility has increased: +7
gpac/gpac maintainer confirmed that a fix has been merged on 75b371 a month ago
The fix bounty has been dropped
rtsp_common.c#L86 has been validated
to join this conversation