Skip to content

Dating a Mach-O File: Build Versions, UUIDs and Signing Time

A Mach-O has no compile timestamp. What it has instead: SDK and toolchain versions, the UUID, the signing time, and quarantine dates outside the file.

Published on 6 min read

TL;DR. A Mach-O file does not record when it was compiled. It records what built it:

  • the SDK and minimum OS, and the linker and compiler versions, in LC_BUILD_VERSION;
  • a build UUID;
  • for a properly signed file, a signing time, ideally vouched for by Apple's timestamp authority.

The SDK version gives a date the build cannot be older than. The secure timestamp gives the signing time to the second. The rest of the timeline (when the file arrived, where from, when it first ran) lives outside the file: in extended attributes, the quarantine database and the file system.

No TimeDateStamp

A Windows PE file carries a link time in its header, and analysts lean on it even though it can be forged (see PE timestamps). The Mach-O header has no such field. The one structure with a "timestamp" is misleading.

The dylib structure used by LC_ID_DYLIB and LC_LOAD_DYLIB has a timestamp field. Apple's current linker writes constants there: 1 in a library's own LC_ID_DYLIB and 2 in every LC_LOAD_DYLIB. All five sample files in Mach-O Parser show exactly that. otool -l prints these as dates in January 1970, which is a rendering artefact, not evidence.

What built it: LC_BUILD_VERSION

Modern binaries carry LC_BUILD_VERSION. Binaries built for systems older than macOS 10.14 carry its predecessor, LC_VERSION_MIN_MACOSX, as the updater-old sample (built for macOS 10.13) does. They record:

  • platform: macOS, iOS, Mac Catalyst, simulators…
  • minos: the oldest system the program accepts. It says who the author meant to reach, not when they built it.
  • sdk: the SDK the program was built against. Each SDK ships with an Xcode release, and betas appear at WWDC in June. A file built with the macOS 27 SDK was built after that SDK existed: a not-before date.
  • tools (only in LC_BUILD_VERSION): the linker and compilers with their versions. Apple's ld alongside clang or swiftc means Xcode or its command-line tools. Google Chrome's launcher, by contrast, lists LLVM's lld 24.0: Chromium is built with its own LLVM toolchain.

The toolchain is a fingerprint as much as a date. A suspicious binary built with an old SDK on a recent toolchain, or with LLVM lld when the rest of the "vendor's" software uses Xcode, is worth a note.

Other build tools leave their own marks, and the Strings tab finds them:

  • Go writes its version and module path into the binary.
  • Rust leaves /rustc/<commit>/library/… paths, and the commit identifies the exact compiler release.
  • PyInstaller and Electron apps carry their runtime's version.

Mach-O Parser detects these toolchains. It reports the Go version and the Rust compiler commit when the file records them.

LC_UUID and LC_SOURCE_VERSION

The UUID is computed by the linker from its output, so two identical links give the same UUID and any change gives a new one. It is not a date, but it ties a binary to its debug symbols (.dSYM) and to crash reports. It also proves whether two files are the same build.

LC_SOURCE_VERSION holds a version number in five parts, A.B.C.D.E. Apple fills it for its own projects: /bin/ls reports 487.40.2. Most third-party builds, including every sample, leave it at 0.

The signing time

The code signature is the only place in the file with a real date, and only for signatures with an identity.

  • Signing time is a signed attribute of the CMS signature. It comes from the signer's own clock, so it is as trustworthy as that machine and that person.
  • A secure timestamp is an RFC 3161 token from Apple's timestamp authority, attached to the signature. It proves the signature existed at that time. Notarization requires it, so a notarized program has one.
  • Ad-hoc and linker signatures carry no time at all.

Mach-O Parser shows the time and where it came from, for example "secure timestamp (RFC 3161)", next to the certificate's validity period. The certificate gives a second sanity check. A signing time outside the leaf certificate's validity, or a "2019" signature on a certificate issued in 2023, does not add up.

Notarization has a date too, but Apple keeps it. It can be looked up online by cdhash, and a stapled ticket travels in the bundle, not in the Mach-O.

Inside the bundle: Info.plist

A bundle's Contents/Info.plist usually holds more build metadata than the Mach-O:

  • CFBundleShortVersionString and CFBundleVersion: the version the developer gave the program;
  • DTXcode, DTXcodeBuild, DTSDKName, DTSDKBuild: the exact Xcode and SDK build (Chrome's says Xcode 2700, SDK macosx27.0);
  • often BuildMachineOSBuild: the macOS build of the machine that compiled it.

Command-line tools may embed a plist in __TEXT,__info_plist, which Mach-O Parser shows in its Info.plist tab. It is covered by the code signature (special slot 1), so it cannot be edited without breaking the signature.

Outside the file: arrival and execution

The dates that matter most in an incident are usually not in the binary at all:

SourceGivesCommand
com.apple.quarantine attributeDownload time (hex Unix time), the downloading app, an event UUIDxattr -p com.apple.quarantine file
kMDItemWhereFroms, kMDItemDownloadedDateThe download URL and referrer, the download datemdls -name kMDItemWhereFroms file
QuarantineEventsV2 databaseEvery quarantined download, with origin URLsqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2
File systemBirth, modification, change and access timesstat -f '%SB %Sm' file
Background Task ManagementWhen persistence was registered, by whomsfltool dumpbtm (macOS 13+)
Unified logExecutions, Gatekeeper and XProtect decisionslog show --predicate …

These attributes only survive if the file was copied with them: cp -p and ditto keep them, many transfers don't. See how to collect suspicious Mac executables safely.

Building the timeline

  1. Not before: the SDK release, the toolchain versions, and the issue date of the leaf certificate.
  2. Built and signed: the secure timestamp if there is one; otherwise the signing time, held to the standard of the signer's clock.
  3. Notarized: online, by cdhash.
  4. Arrived: the quarantine attribute, WhereFroms and the quarantine database.
  5. Installed and persisted: birth times, BTM records, the launchd plist's own dates.
  6. Ran: the unified log, EDR telemetry.

Each step is independent evidence, and the gaps between them tell their own story. A binary signed months before the campaign and downloaded the day of the incident points to infrastructure that was ready and waiting.

Frequently asked questions

Does a Mach-O file contain its compile time?

No. Unlike a PE file, a Mach-O has no field recording when it was built. The closest things are the code signature's signing time and secure timestamp. The SDK and toolchain versions recorded in LC_BUILD_VERSION give a not-before date.

What is the timestamp field in LC_LOAD_DYLIB?

The dylib structure has a timestamp field, but today's linker writes constants into it: 2 in LC_LOAD_DYLIB and 1 in LC_ID_DYLIB. It dates nothing, and otool's rendering of it as a date in January 1970 is not evidence.

Where does macOS record when a file was downloaded?

In the com.apple.quarantine extended attribute (a hexadecimal Unix time, the downloading application and an event UUID), in the kMDItemWhereFroms and kMDItemDownloadedDate metadata, and in the user's QuarantineEventsV2 database, which also keeps the origin URL.

Related articles

A walkthrough of Mach-O Parser on five harmless samples: triage, signatures, entitlements, a dropper's payload, compare, YARA and exports. Nothing uploaded.
Where Mac malware keeps its binaries, how to copy them without running them and without losing the quarantine attribute, and how to package an .app, a .dmg or a .pkg for analysis on another machine.
How a Mach-O is code-signed, which codesign --verify checks work offline, and what ad-hoc, linker-signed and Developer ID signatures really mean.