Author: impost0r
Published: June 29, 2026
Source: https://ret2p.lt/2026/06/29/cottou.html
Summary
“Cottou” is a writeup by impost0r describing an out-of-bounds segment-index flaw in Apple’s dyld dynamic linker that can be turned into arbitrary code execution when a malicious dynamic library is loaded. The bug lies in how dyld processes rebase opcodes while binding a Mach-O image: a 4-bit segment index taken from an attacker-controlled opcode is used without bounds checking, allowing reads past a fixed-size segment array. The author states that no CVE was assigned — ZDI declined the submission — and treats the issue as a 0day pursued via full disclosure, so at the time of writing no official patch exists. As always, the technical details below are drawn from the source; where the source does not specify something, this summary says so rather than filling the gap.
Technical Details
According to the writeup, the vulnerability is in MachOAnalyzer::forEachRebase_Opcodes(). When dyld handles the REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB opcode, it extracts a 4-bit immediate (values 0–15) and uses it directly as a segment index without validating it against the actual number of segments in the image. A typical dylib has around three segments (valid indices 0–2), so indices 3–15 index out of bounds into a fixed-size stack array. The out-of-bounds read pulls arbitrary stack values which, combined with attacker-controlled segmentOffset values from the same opcode stream, can be composed into an arbitrary write primitive during the rebase pass. The author frames this as a linker-level parsing bug: the malicious content lives inside the Mach-O rebase opcode data of a crafted dylib.
Impact
The source describes per-process code execution achieved when a target process loads the malicious dylib. impost0r reports that the technique bypasses PAC, AMFI, and Lockdown Mode on macOS/iOS and can be used to deploy a userland rootkit. When paired with launchctl to set environment variables, it is described as functioning as a DYLD_INSERT_LIBRARIES injection vector, affecting newly spawned processes that accept the malicious dylib. The affected component is Apple’s dyld on macOS and iOS; the writeup does not enumerate specific OS version numbers, so the precise affected-version range is not stated in the source.
Mitigation
The author reports no official Apple patch at publication time, consistent with the 0day/full-disclosure status and the lack of an assigned CVE. No vendor advisory or fixed version is cited in the source. As a general defensive posture for this class of issue, only load dynamic libraries from trusted, code-signed origins, be wary of DYLD_INSERT_LIBRARIES and untrusted environment configuration, and apply Apple security updates as they become available. These are standard recommendations, not a vendor-confirmed fix.