Gdb: gdb: out-of-bounds write in stabs parser read_member_functions() via crafted elf
Red Hat / Red Hat Enterprise Linux 10、Red Hat Enterprise Linux 10.0 Extended Update Support、Red Hat Enterprise Linux 8、Red Hat Enterprise Linux 8.4 Advanced Mission Critical Update Support、Red Hat Enterprise Linux 8.4 Extended Update Support Long-Life Add-On、Red Hat Enterprise Linux 8.6 Advanced Mission Critical Update Support +15
A flaw was found in GDB's STABS debug format parser. The
read_member_functions() function in gdb/stabsread.c contains a linked
list removal bug in the code that separates destructor and non-destructor
member functions of C++ classes. The bug causes the destructor entries to
remain in the main function list while the list length counter is
decremented, resulting in an out-of-bounds write when the function list
is copied to its final allocated array. An attacker can craft an ELF
binary with malicious .stab and .stabstr sections that triggers this
out-of-bounds write when a user opens the file in GDB and performs any
symbol-inspection operation such as setting a breakpoint. The inferior
process does not need to be executed. Under controlled conditions, this
was demonstrated to achieve execution of arbitrary commands within the
GDB process.