binutils Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
bfd/macho

Prevent out-of-bounds read in Mach-O prebound dylib parsing

Fixes a heap out-of-bounds read vulnerability in Mach-O parsing caused by incorrect offset calculations.

A vulnerability in the Mach-O parser allowed for a heap out-of-bounds read when processing LC_PREBOUND_DYLIB load commands. The bfd_mach_o_read_prebound_dylib function incorrectly calculated pointers into a shared buffer, leading to reads outside the allocated memory. This fix modifies the parsing logic to read the name and linked modules separately using validated offsets and bfd_mach_o_alloc_and_read, ensuring proper memory bounds and null termination, and preventing potential information disclosure or corruption.

In Details

The bfd_mach_o_read_prebound_dylib function in bfd/mach-o.c had a vulnerability where derived pointers for the command's name and linked modules could underflow due to subtracting a fixed constant from load-command-relative offsets without lower-bound checks. This, combined with a lack of guaranteed NUL termination for the name, allowed crafted Mach-O files to trigger out-of-bounds reads when processed by objdump -P load_commands. The fix replaces pointer arithmetic with direct reads via bfd_mach_o_alloc_and_read, which handles seeking, allocation, and NUL termination, while also addi…

For Context
Mach-O
The executable file format used by macOS, iOS, and other Darwin-based operating systems. It stands for Mach Object.
load command
A structure within a Mach-O file that describes how the operating system should load and process the file, such as specifying segments, libraries, or dynamic linker information.
LC_PREBOUND_DYLIB
A specific type of Mach-O load command that indicates a prebound dynamic library, providing information about its linked modules.
out-of-bounds read
An operation that attempts to access memory outside the allocated boundaries of a buffer, potentially leading to crashes or security vulnerabilities.
objdump
A common utility for displaying information from object files, including disassembly and symbol tables.
Filed Under: machobinutilssecurityobjdumpvulnerability