aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2026-08-31 20:22:13 +0300
committerMike Gilbert <floppym@gentoo.org>2026-09-01 14:17:07 -0400
commit0a8e128bcadd04fba5c5f91be8016638522310f5 (patch)
tree7e9310c11beb662f9acb21071055a4127f2de5f1 /.github
parentlibsandbox: reject a file that is not an ELF before walking it (diff)
downloadsandbox-master.tar.gz
sandbox-master.tar.bz2
sandbox-master.zip
libsandbox: keep the ELF walk inside the file it mappedHEADmaster
sb_check_exec() reads a program's headers to decide whether it has to be traced rather than run in-process, and took every offset in them at face value. |e_phoff| was only weighed against the file size after the program header pointer had been formed from it, and with the entry size never compared against the structure being indexed and the entry count folded in by a multiplication that can wrap, that check could pass for a table that is not there. A PT_DYNAMIC entry was then followed to wherever its |p_offset| pointed and read until something looked like a DT_NULL, and the symbol and string table offsets were used unweighed as well, so an ELF whose headers disagree with its length faulted the process that is only trying to exec it. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org> Closes: https://github.com/gentoo/sandbox/pull/45 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions