Report

CVE-2017-8421: binutils objdump unbounded allocation from forged ELF section metadata

375f2399-351f-4936-a195-7966b142b887

GNU Binutils 2.28 objdump suffers an unbounded memory allocation (DoS) when processing a crafted ELF file. The dump_relocs_in_section() and dump_dynamic_relocs() paths in binutils/objdump.c (and the disassembly preload at ~line 2353) call bfd_get_reloc_upper_bound() / bfd_get_dynamic_reloc_upper_bound() and pass the result straight into xmalloc() with no validation against the real file size. The BFD helper _bfd_elf_get_dynamic_reloc_upper_bound() in bfd/elf.c lines ~8023-8044 computes ret += (s->size / sh_entsize) * sizeof(arelent *) with no check that sh_entsize is non-zero and no clamp on s->size, so a SHT_RELA section header claiming sh_size=0x7fffffff produces an enormous bound that objdump tries to allocate.