binutils Newspaper
NOVEMBER 30, 2026
readelf — Proposed

readelf: fix SHT_GROUP, DT_RELR and string dump bounds

Addresses multiple bugs in readelf related to section group processing, DT_RELR relocation dumping, and string section boundary checks.

This patch corrects three distinct issues in the readelf utility: 1) It prevents division by zero and out-of-bounds reads when processing SHT_GROUP sections by adding checks for sh_entsize and sh_size. 2) It resolves a heap buffer overflow when dumping DT_RELR relocations by ensuring proper buffer sizing and allocation. 3) It fixes an issue where dump_section_as_strings could read past the end of a buffer by adding boundary checks.

In the Thread 1 participant
  1. mustafa <mustafa@medios.digiscrypt.com> proposer

    Fixes three separate issues in readelf: section group processing bounds, DT_RELR relocation buffer overflows, and string dump boundary issues.

    “Three separate problems in readelf, all reachable from a crafted file.”

In Details

This PR tackles three vulnerabilities/bugs in readelf: 1) process_section_groups is fixed to handle zero sh_entsize and small sh_size values correctly, preventing division-by-zero and incorrect member counts. 2) Heap buffer overflows in process_relocs when dumping DT_RELR relocations after other relocation types are fixed by ensuring proper buffer allocation with xcmalloc and xcrealloc. 3) dump_section_as_strings is corrected to prevent reading past buffer bounds, especially for decompressed sections, by properly bounding maxlen.

For Context
readelf
A utility that displays information about ELF files, including section headers, symbols, and relocation entries.
SHT_GROUP
A section header type indicating a section containing group of symbols.
DT_RELR
A dynamic tag in the ELF header that indicates a table of relative relocations.
ELF
Executable and Linkable Format, a common standard for object file formats on Unix-like systems.
heap buffer overflow
A type of security vulnerability where a program writes data beyond the allocated buffer in the heap, potentially corrupting other data or executing malicious code.
xcmalloc
A memory allocation function that checks for allocation errors.
Filed Under: binutilsreadelfelfsecuritybugfix