ZeroHour
GBHackerspublished ()ingested Divya1

Apple Xcode Integer Underflow Flaw Lets Crafted Archives Leak Memory and Crash Builds

mediumVulnerabilityimportance 42
AI summary · glm-5.3-flash

Researchers disclosed an integer underflow in Apple's Mach-O archive parser that lets crafted static libraries crash Xcode builds or leak process memory.

SecureLayer7 disclosed an integer underflow in the mach_o::Archive::Entry::name() function in Apple's open-source dyld project, reported to Apple Product Security on May 23, 2026, with no public patch after more than 90 days. Crafted static archives (.a files) cause the parser's unsigned index to wrap to SIZE_MAX, producing SIGSEGV crashes in the ld-prime linker, out-of-bounds reads that may print adjacent memory to stderr, or SIGABRT in libtool and ranlib. The modern parser is used by ld-prime, the default linker for arm64, arm64e, and x86_64 since Xcode 15, while legacy ld-classic is unaffected. Crafted archives need only be processed, creating supply-chain risk via vendored SDKs, binary dependencies, and CI pipelines.

  • Bug sits in mach_o::Archive::Entry::name(), where an unsigned index trimming spaces wraps to SIZE_MAX and overreads.
  • Affects ld-prime, default linker since Xcode 15, plus libtool and ranlib; legacy ld-classic is unaffected.
  • Outcomes include SIGSEGV crashes, out-of-bounds reads printing adjacent memory, and SIGABRT from oversized std::string allocations.
  • Crafted .a files only need processing, creating supply-chain risk via vendored SDKs, dependencies, and CI pipelines.
  • SecureLayer7 reported to Apple on May 23, 2026; over 90 days passed without a public patch.
Full article654 words · extracted from gbhackers.com · click to collapse

A recently disclosed integer-underflow vulnerability in Apple’s modern Mach-O archive parser could allow a malicious static library to crash Xcode build processes or expose process memory through build logs.

This flaw affects the parser used by Apple’s newer linker, ld-prime, as well as related developer tools, including libtool, ranlib, and potentially dyld_info.

Apple Xcode Integer Underflow Flaw

Security researchers at SecureLayer7 reported that the issue lies in the `mach_o::Archive::Entry::name()` function, which parses the 16-byte filename field in Unix static archives (.a files).

Since static archives are often downloaded as prebuilt dependencies through package managers, vendor SDKs, and CI pipelines, this vulnerability presents a significant risk to the software supply chain.

The vulnerable code attempts to trim trailing spaces from an archive member name using an unsigned size_t index. When an attacker supplies an `ar_name` field filled with space characters, the loop decrements past index zero.

Instead of terminating safely, the unsigned value wraps to `SIZE_MAX`, causing the parser to walk backward outside the intended archive-name buffer. The function then returns a `std::string_view` with a valid-looking pointer but with an attacker-influenced, near-maximum length.

This corrupted length subsequently reaches normal toolchain error-handling and string-processing paths, leading to one of the following three outcomes:

  • A deterministic `SIGSEGV` when the linker’s formatting code calls `strlen()` and reads past the mapped archive file.
  • An out-of-bounds read that may print bytes from adjacent memory mappings to standard error.
  • A `SIGABRT` in libtool or ranlib after an attempt to allocate an impossibly large `std::string`, resulting in an uncaught `std::bad_alloc`.

The researchers demonstrated the issue with small crafted .a files, emphasizing that the archive is data rather than executable code. In other words, the payload needs only to be accepted as input for linking or archive processing; it does not need to be compiled or run as a program.

Apple’s mach_o library is part of the open-source dyld project and is used by the modern toolchain included with Xcode and Command Line Tools.

SecureLayer7 states that ld-prime has been the default linker for arm64, arm64e, and x86_64 builds since Xcode 15. Meanwhile, libtool and ranlib invoke developer-tool versions that use the same parser.

The legacy ld-classic linker reportedly utilizes separate, older archive-parsing code and is not affected by this vulnerability.

This distinction may give teams a temporary compatibility option where using the legacy linker is technically feasible; however, organizations should validate the build and security implications before changing linker settings.

The primary concern lies within automated build environments. A compromised archive embedded in a third-party SDK, binary dependency, vendored framework, or transitive package could be processed by a developer workstation or CI runner.

A crash could hinder releases, while sensitive memory information printed to CI logs could pose a significant confidentiality risk.

Disclosure and Mitigation  

SecureLayer7 reported the issue to Apple Product Security on May 23, 2026, and noted that more than 90 days passed without a public patch. The report indicates that Apple characterized the finding as having “Limited Local Impact.”

This is the researcher’s account; Apple has not published a corresponding security advisory for Xcode in the reviewed materials.

Until Apple releases a fix, development and DevSecOps teams should treat untrusted static archives as high-risk build inputs by following these recommendations:

  • Pin and verify checksums for prebuilt .a dependencies.
  • Prefer reproducible builds from reviewed source where possible.
  • Restrict dependency ingestion in CI, especially from pull requests and external forks.
  • Run builds in isolated, short-lived workers with minimal credentials and restricted log access.
  • Monitor build failures involving ld, libtool, ranlib, EXC_BAD_ACCESS, or abnormal memory-allocation errors.

Apple’s public dyld repository contains the modern C++ codebase that maintains the affected archive parser.

Keep your SOC up to date on active malware & phishing within 24h of their emergence. Try ANYRUN to prevent incidents with early detection

Divya

Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Text extracted automatically; images, tables and formatting may be missing. Original: https://gbhackers.com/apple-xcode-integer-underflow-flaw/