Zen Software / Apple Internal Investigator
Forensic and protocol study · October 5, 2026← All papers

0. How to read this document

This revision was rewritten from the ground up after machine-checking every claim in the previous version against the files actually present in this repository. That process changed the document in three ways that matter more than any of its prose:

  1. Every artifact is now referenced by its real path in the project, not by the bare name the previous version used. The previous Appendix A listed 102 files; 22 of those 102 names do not exist on disk — they carry macOS download-collision suffixes (lib(1).sh, README(1).txt, test_gains(1).sh, …) that were never part of the image. Appendix A now gives the true path for each one.

  2. Every quantitative claim is reproduced. Where a number is stated here, it was recomputed from the artifact. Reproduced figures are marked [reproduced]; claims that are direct quotations from a log are marked [quoted]; claims that are interpretation are marked [inference]; and claims that turned out to be wrong or overstated are called out explicitly in §C.

  3. The device-identity evidence converges rather than conflicts. See §1.3. The software self-report (iPhone10,3), decoded CHIP = 0x8015, and BORD = 0x06 are mutually consistent with an iPhone X / D22AP. The prior XS/XS Max reading confused the A11/T8015 platform with later A12 devices and is withdrawn.

Verification tooling. The checks in this document are reproducible with the two scripts added alongside it:

Script What it does
tools/verify_analysis_inventory.py Re-derives every Appendix A row from disk: existence, byte size, SHA-256 prefix.
tools/analysis_artifact_map.py Emits the document-name → real-path mapping, tolerating the (1)-suffix mismatch.

Run from the repo root:

python3 tools/verify_analysis_inventory.py
python3 tools/analysis_artifact_map.py

Current result: 102/102 rows resolve to a real file; 101/102 match the recorded SHA-256 (the single exception is a SQLite -shm file, which is volatile by construction — see Appendix C).

Scope of this polish audit. The [reproduced] and [quoted] labels below refer to the earlier corpus-verification pass described by this report. This polish pass had the report source available, not the complete 147,232-file corpus, so it did not rerun those on-disk checks. It did audit internal consistency and cross-check stable external facts where they materially affect interpretation: Apple device identifiers/CPID/BDID, ECID width, RFC 5480 EC key AlgorithmIdentifiers, and RFC 5869 HKDF terminology. Those external checks are listed in Appendix F and are kept separate from corpus-derived evidence.

Path shorthand. Appendix A uses two abbreviations to keep a 102-row table readable:

Evidence policy (unchanged from the previous version, and still load-bearing). This report does not reproduce private key scalars, authentication headers, persistent cookies, UDID-derived values, or opaque provisioning secrets. Where such material is structurally relevant, the report gives structure, length and provenance instead. No private scalar from d-maha-s.pem / d-maha-e.pem appears anywhere in this document, and the SIProv analysis is written so that it is reproducible without them.

On terminology. Internal codenames (Maha, Hilo, LTH, Seshat, Navajo, SSE, TDM, SIGPROV) are preserved exactly as the corpus spells them. Where this document proposes an expansion it is marked [inference] and the basis is given; where no expansion is supportable it says so rather than inventing one.

1. Corpus, scope, and device identity

1.1 What the corpus is

The analysis rests on a full iOS filesystem capture rooted at XsMax_12.1.1_JF36/, containing 147,232 files. The 102 artifacts in Appendix A are the ones this document reasons about; the remainder are the ordinary userspace image and are cited only where they discriminate a question.

1.1.1 What the corpus contains that this document does not use

Stated explicitly, because "artifact inventory" normally implies the analysis consumed everything it lists, and it did not. These are in-corpus, unanalysed, and each is a real next target [reproduced by locating them on disk]:

Artifact Path Size Why it matters / why it is unused
keybagd (Mach-O) X/usr/libexec/keybagd 444,672 B The keybag daemon binary itself. §4.2–4.3 establish keybagd's behaviour from logs only. The binary would let a reader recover the actual opaqueStuff layout, the _MKBPAYLOAD framing (§4.1), and what a health check evaluates. This is the single largest available improvement to §4.
keybagdTest (Mach-O) X/usr/local/bin/keybagdTest 226,032 B Apple's own keybag test binary; likely the fastest route to SystemBag serialization semantics.
sep-firmware.img4 X/usr/standalone/firmware/sep-firmware.img4 7,510,874 B The device's SEP firmware. §2–§3 analyse the host-side test harness, never SEPROM internals — which is why §16.2 can say SEP internals are not exposed. This file could change that, and was not opened for this revision.
Baseband/Mav17/*.mbn X/usr/local/standalone/firmware/Baseband/Mav17 8 files Plaintext ELF baseband firmware; used in §1.3 as an identity cross-check only.
PrivateFrameworks/ repo root 119 files Developer MTL/GPU tools frameworks. Present in the tree, irrelevant to this document's domains.
iPhoneX_16C49.tar.xz repo root 3.9 GB Unextracted, unexamined.

A reader should read §16.2 ("what the corpus does not expose") together with this table: several "not exposed" items are not exposed by this analysis, which is weaker than "not present in the corpus".

The capture is not alone in the repository. Two sibling corpora are present and are used in exactly two places, both to disqualify an inference rather than support one:

Corpus Role in this analysis
XsMax_12.1.1_JF36/ The primary corpus. 147,232 files; source of all 102 artifacts.
D16AP/ Used once, §1.3, to show that Mav21 is a different baseband family from the Mav17 in the primary corpus.
Baseband/Mav17/, Baseband/Mav21/ Plaintext ELF .mbn images. Not part of the SEP/Lockdown analysis; relevant only as the Mav17/Mav21 distinction in §1.3.

1.2 Build identity — verified

XsMax_12.1.1_JF36/System/Library/CoreServices/SystemVersion.plist [reproduced]:

Field Value
ProductName iPhone OS
ProductVersion 12.1.1
ProductBuildVersion 16C49
ReleaseType Internal
BuildID 984E0EEE-E556-11E8-9E44-6025232787AC
SystemImageID AE8B774D-008B-47B7-851F-86B627AE2AAD

ReleaseType: Internal is the load-bearing field and it is in the image's own version plist, not merely implied by the presence of internal tooling. The previous version asserted "internal/development/factory-capable" from log strings; this is stronger and simpler.

1.3 Device identity — the independent evidence converges on iPhone X / D22AP

This section contained the most consequential error in the prior draft. The on-disk observations were useful, but the product mapping applied to them was wrong. Once the stable Apple identifiers are decoded correctly, the evidence is mutually reinforcing rather than contradictory.

Evidence A — the device's own self-report. lockdownd reads its product type from an internal device-tree block and logs it. XsMax_12.1.1_JF36/private/var/logs/lockdownd.log.1 [quoted, 13 occurrences]:

10/15/19 13:53:48.093896 pid=59 get_device_type_internal_block_invoke: product_type: iPhone10,3
10/15/19 14:19:16.291728 pid=59 get_device_type_internal_block_invoke: product_type: iPhone10,3
10/15/19 14:22:44.596338 pid=59 get_device_type_internal_block_invoke: product_type: iPhone10,3

The same product type appears in the device's diagnostic traces: the file private/var/db/diagnostics/Persist/0000000000000003.tracev3 contains both 001551680450E02E (the device ECID used below) and iPhone10,3 [reproduced: 2 and 6 occurrences]. So the self-report is corroborated in two independent log families.

Evidence B — the factory-provisioning chain. XsMax_12.1.1_JF36/System/Library/Caches/com.apple.factorydata/ contains three artifacts whose names embed <chip>-<ecid> [reproduced]:

scrt-00008015-001551680450E02E     3,022 bytes
ccrt-00008015-001551680450E02E     3,022 bytes
seal-00008015-001551680450E02E    10,334 bytes

The chip field is also present inside the scrt binary. Decoding the IMG4 property encoding at the CHIP tag [reproduced]:

bytes:  30 0b 16 04 43 48 49 50 02 03 00 80 15 
         ^^^^^^^^^ OCTET STRING "CHIP"        ^^^^^^^^^
                                            INTEGER 0x008015

CHIP = 0x8015 is the T8015 / A11 platform CPID, and BORD = 0x06 is the D22 board ID. Those values match the public mapping for iPhone10,3: iPhone X (Global), D22AP, CPID 0x8015, BDID 0x06. They do not identify an iPhone XS or XS Max; those are A12/T8020-generation devices with iPhone11,* identifiers. This mapping is an external consistency check, not a replacement for the corpus evidence; see Appendix F.

The ECID property decodes to 0x1551680450E02E, matching the filename suffix 001551680450E02E [reproduced]. Filename, manifest property, diagnostic trace, and software product type therefore point to the same device identity.

Evidence C — the build itself independently fits that identity. The corpus reports internal build 16C49 (§1.2). Public archival metadata for Apple's internal PeaceC 16C49 build lists it as an iOS 12.1.1 Internal build for the iPhone X / D22AP, with an A11/T8015 development kernel. This is supporting external evidence only; the primary build identity remains the on-disk SystemVersion.plist.

What still should not be used as identity evidence.

The second ECID is still a fixture, not a contradiction. There are two distinct ECIDs in the corpus [reproduced]: 001551680450E02E in factorydata/ and diagnostics, and 000E790124C3C12E only in AppleSEP/unit_tests/hilo/scrt-00008015-000E790124C3C12E. The latter is a test fixture shipped with the SEP unit-test tree (§3.11), not evidence of a second physical device.

factorydata/ also contains baseband items (bbcl-0003B0E1-8A1239E8, bbpc-…, bbpv-…) using a modem-specific identity namespace [reproduced]. Those identifiers should not be compared directly with AP ECID/CPID fields.

Conclusion. At the confidence supported by the report plus stable external identifier tables, the primary corpus is an internal iPhone OS 12.1.1 (16C49) iPhone X / D22AP environment. Its software self-report (iPhone10,3), factory CPID (0x8015), board ID (0x06), and device ECID are consistent. The earlier "XS versus XS Max" conflict was an interpretation error, not a contradiction in the artifacts.

2. SEP provisioning / SIGPROV / Maha

All artifacts in this section are in XsMax_12.1.1_JF36/AppleInternal/CoreOS/AppleSEP/unit_tests/SiProvisioning/siprov_HSM_emulator/. The prefix is abbreviated <$>/SiProvisioning/siprov_HSM_emulator/ below.

2.1 Inventory and roles

siprov_HSM_emulator.sh (21,863 bytes) is a shell HSM emulator driving an eight-message protocol. Message-name occurrence counts in the script [reproduced]:

S1 ×17   S2 ×15   S3 ×12   C1 ×9   C2 ×8   C3 ×8   FFS2 ×5   FFC2 ×6

Supporting artifacts:

Role Artifact
Signing private key d-maha-s.pem (227 B)
Signing public key q-maha-s.pem (178 B), q-maha-s.der (91 B)
ECDH private key d-maha-e.pem (227 B)
ECDH public point q-maha-e.der2 (89 B) — distinct AlgorithmIdentifier
AlgorithmIdentifiers AlgorithmIdentifier-ecPublicKey (21 B), …-ecdsaWithSHA256.der (12 B), …-hmacWithSHA256-2.der (14 B)
KDF input kgengid3b.txt (65 B) — one 32-byte hex value
Private-fuse vectors privatefusevalues.bin.{personalization,hdcp13,hdcp22,hdcp13.hdcp22}

2.2 Cryptographic primitives — as invoked, not as named

The previous version described algorithms from their names. This section quotes the invocations instead. OpenSSL call-shape census [reproduced]:

19 × -sha256          (dgst -sha256, with and without -mac HMAC)
 3 × pkeyutl -derive -inkey d-maha-e.pem -peerkey q-sep-e.pem.out
 3 × -aes-256-cbc
 1 × -hmac

Three of those are load-bearing and were previously described inaccurately:

(a) ECDH is pkeyutl -derive. Line 232 [quoted]:

# Compute Z = DH(d-maha-e, q-sep-e)
$SEPSSL pkeyutl -derive -inkey d-maha-e.pem -peerkey q-sep-e.pem.out \
-out z.bin.v

(b) The extraction step is HMAC-SHA256 and is mathematically HKDF-Extract, but the later derivations are not RFC 5869 HKDF-Expand. Line 235 [quoted]:

# Compute kdk1 = hkdf-extract(kgengid3b, z)
$SEPSSL dgst -sha256 -mac HMAC -macopt hexkey:`cat kgengid3b.txt` \
-binary -out kdk1.bin.v z.bin.v

The comment says hkdf-extract, and that description is mathematically accurate: RFC 5869 defines HKDF-Extract(salt, IKM) as HMAC-Hash(salt, IKM), which here maps to salt = kgengid3b and IKM = Z. What the script does not implement is RFC 5869 HKDF-Expand: every later key is a single HMAC over an explicitly constructed protocol-specific byte string. So the precise statement is HKDF-Extract-compatible extraction followed by a custom HMAC-based expansion/key schedule, not "not HKDF".

(c) -iv 0 -salt is self-contradictory under OpenSSL and should not be transcribed as "IV = 0 with salt". Line 316 [quoted]:

$SEPSSL enc -aes-256-cbc -in privatefusevalues.bin -out \
aes-k2enc-privatefusevalues.bin.out -K `cat k2enc.txt.out` \
-iv 0 -salt

With -K (raw key, no PBKDF), OpenSSL's -salt has no effect on key derivation and is ignored; and -iv 0 supplies a zero IV directly. So the effective construction is AES-256-CBC, raw key, zero IV, and -salt is vestigial. The same inconsistency appears again at line 434 (-iv 0 -salt, encrypt path) and the C3 decrypt at line 557 uses -nosalt -iv 0 [quoted], i.e. the author was explicit where it mattered and not where it did not.

2.3 The two public keys use deliberately different AlgorithmIdentifiers

q-maha-s.der and q-maha-e.der2 are both compact DER SubjectPublicKeyInfo-like encodings carrying a P-256 point, but their algorithm OIDs differ [reproduced]:

Artifact AlgorithmIdentifier
q-maha-s.der id-ecPublicKey (1.2.840.10045.2.1) + prime256v1
q-maha-e.der2 id-ecDH (1.3.132.1.12) + prime256v1

This distinction has a standards-defined meaning. RFC 5480 defines id-ecPublicKey as the unrestricted EC public-key identifier and id-ecDH as a restricted identifier for ECDH key agreement. The earlier draft incorrectly called 1.3.132.1.12 an ANSI X9.62 prime256v1 OID; prime256v1 is the parameter naming the curve, while 1.3.132.1.12 names the ECDH algorithm.

The harness itself demonstrates a compatibility conversion. It does not pass the peer's id-ecDH wrapper directly to $SEPSSL ec; instead it rebuilds a public-key wrapper with AlgorithmIdentifier-ecPublicKey and then parses that:

echo -n "3059" | xxd -ps -r > der.temp
cat ./AlgorithmIdentifier-ecPublicKey >>der.temp
cat ./q-sep-e.bitstring.out >> der.temp
mv ./der.temp q-sep-e.derpub.out
$SEPSSL ec -pubin -inform DER -in ./q-sep-e.derpub.out -outform PEM -out q-sep-e.pem.out

The hard-coded 3059 outer SEQUENCE header couples this code to the expected fixed-size P-256/uncompressed-point representation. It is better described as a representation assumption in the test harness than as a protocol weakness: for the encoding this harness expects, the length is fixed; a different point encoding would require rebuilding the DER lengths rather than reusing 3059.

2.4 Message S1/S3 — what is actually signed

make_S1_S3 builds the public parameters as [quoted, lines 95–113]:

function make_S1_S3() {
# Generate MS1
	cp q-maha-e.der2 pubparam.temp.body
# ApChipID
	der_encode_blob ${INTEGER_TAG} apchipid.bin apchipid.bin.temp
	cat apchipid.bin.temp >> pubparam.temp.body
# ApECID
	der_encode_blob ${INTEGER_TAG} apecid.bin apecid.bin.temp
	cat apecid.bin.temp >> pubparam.temp.body
# Regression run or not
	if (( ($REGRESSION == 1) && ($1 == 3) )); then
		echo -n "020101" | xxd -r -p >> pubparam.temp.body          # INTEGER + Length + regression
	fi

So the signed payload is:

SEQUENCE {
  OCTET STRING   q-maha-e.der2            -- the exchange point, verbatim
  INTEGER        <ApChipID>              -- DER re-encoded
  INTEGER        <ApECID>                 -- DER re-encoded
  INTEGER 1      0x01                     -- S3 regression marker, optional
}

The signing public key travels outside the signed body and the verifier requires it to match the supplied q-maha-s before verifying [reproduced: the signing key comparison is present in the verify path]. Security consequence, stated precisely: the signature binds (exchange point, chip id, ECID) under a signing key the verifier pins out of band. When the S3 regression marker is present (REGRESSION=1), it is appended inside the signed body and is therefore bound by the signature as well.

2.5 Device identity derivation — full ECID, endian-normalised for DER

The previous revision misread the width of unique-chip-id. Lines 588–605 [quoted]:

if [ ! -f apecid.bin ]; then
ioreg -r -p IODeviceTree -n chosen | \
	awk '/\"unique-chip-id\"/ {print(substr($4,2,16));}' | \
	awk '{ for(i=length;i!=0;i=i-2)x=x substr($0,i-1,2);}END{print x}' | \
	sed -E 's/^0*([0-7].(..)*)$/\1/g' | \
	xxd -ps -r > apecid.bin
fi

Read as a pipeline:

  1. substr($4,2,16) extracts 16 hexadecimal characters = 8 bytes. ECID / UniqueChipID is a 64-bit value, so this is the full ECID representation used by the device-tree property, not a truncation.
  2. The second awk reverses byte order. Device-tree dumps expose the 64-bit property as bytes in little-endian order; reversing the eight bytes produces the conventional big-endian integer representation.
  3. The sed expression removes redundant leading zero bytes only when the next high nibble is 0-7. That condition preserves a leading zero when it is required to keep a DER INTEGER positive (high bit clear).

So the useful implementation statement is:

apecid.bin contains the full 64-bit ECID, converted from the device-tree byte order into a minimal positive big-endian INTEGER payload suitable for DER wrapping.

For apchipid.bin, the same normalization is applied to the 3-byte chip ID via substr($4,2,6) [reproduced].

This matters for an emulator in the opposite direction from the previous revision: truncating a larger imagined identifier or treating the byte reversal as lossy would be wrong. A compatible implementation should preserve all eight ECID bytes, normalize their byte order, and retain a protective leading zero when DER INTEGER sign rules require it. The adjacent rdar comment <rdar://problem/29577478> Provisioning test will fail on devices with certain ECIDs is consistent with edge cases in integer encoding, but the corpus does not establish the bug's exact cause.

2.6 KDF: direction and purpose separation, verified in both directions

The previous version stated the two K2 derivations but did not verify the operand order, which is the part that actually differs between directions. Both verified [quoted]:

SEP → Maha (K1_MAC), line 241:

cp q-sep-e.der2.out hmac-k1mac-body.bin.v     # SEP key FIRST
cat q-maha-e.der2 >> hmac-k1mac-body.bin.v     # then Maha key (NOT .out)
printf %s "Fusing SEP to Maha" >> hmac-k1mac-body.bin.v
printf %s "mac" >> hmac-k1mac-body.bin.v
echo "01" |  xxd -r -p >> hmac-k1mac-body.bin.v

Maha → SEP (K2_ENC), line 274, and K2_MAC, line 285:

cp q-maha-e.der2 hmac-k2enc-body.bin.out       # Maha key FIRST
cat q-sep-e.der2.out >> hmac-k2enc-body.bin.out # then SEP key
printf %s "Fusing Maha to SEP" >> hmac-k2enc-body.bin.out
printf %s "enc" >> hmac-k2enc-body.bin.out
echo -n "01" | xxd -r -p >> hmac-k2enc-body.bin.out

Two details the previous version missed, both reproduced above:

Full derivation set [reproduced]:

Z        = ECDH(d-maha-e, q-sep-e)
KDK1     = HMAC-SHA256(key = kgengid3b, data = Z)
K1_MAC   = HMAC-SHA256(KDK1, q-sep-e.der2.out || q-maha-e.der2
                       || "Fusing SEP to Maha" || "mac" || 0x01)
K2_ENC   = HMAC-SHA256(KDK1, q-maha-e.der2 || q-sep-e.der2.out
                       || "Fusing Maha to SEP" || "enc" || 0x01)
K2_MAC   = HMAC-SHA256(KDK1, q-maha-e.der2 || q-sep-e.der2.out
                       || "Fusing Maha to SEP" || "mac" || 0x01)

The identity-certification branch uses a distinct label, "SEP Identity Certification" (2 occurrences, lines 516 and 519) [quoted], with its own mac/enc pair and its own KDK [reproduced].

2.7 S2 — encrypted private-provisioning transfer

make_S2 derives K2_ENC/K2_MAC from KDK1 and, when privatefusevalues.bin exists and the mode is normal, encrypts it [quoted, line 314]:

if [ -e privatefusevalues.bin ]; then
if (( $1 == 0 )); then
	$SEPSSL enc -aes-256-cbc ... -K `cat k2enc.txt.out` -iv 0 -salt

Effective construction, per §2.2(c): AES-256-CBC, raw key K2_ENC, zero IV. The ciphertext is DER-wrapped as an OCTET STRING and S2 is authenticated with K2_MAC.

The verifier is present in the corpus and closes the loop [quoted, line 433]:

# Decrypts the PrivateFuseValues
$SEPSSL enc -d -aes-256-cbc -out privatefusevalues.bin.v -in \
aes-k2enc-privatefusevalues.bin.out.v -K `cat k2enc.txt.out.v` -iv 0 -salt
diff privatefusevalues.bin privatefusevalues.bin.v

So both directions are present, and the test asserts a byte-exact plaintext round trip. The harness also authenticates the containing message separately. However, this report should not justify the fixed zero IV by asserting a fresh K2_ENC on every transaction: the Maha ECDH private key is static in this test fixture, and peer-key freshness is not demonstrated by the artifacts summarised here. The safe finding is narrower: this harness uses raw-key AES-256-CBC with a zero IV plus a separate MAC; production key/nonce freshness is not established by this corpus excerpt.

2.8 PrivateFuseValues ASN.1 — verified structurally, including the cross-vector detail

All four vectors parse as DER [reproduced]:

Vector Bytes Structure
.personalization 52 SEQUENCE { OCTET STRING[48] }
.hdcp13 362 SEQUENCE { OCTET STRING[48], [1] { SEQUENCE { OCTET STRING[288], INTEGER } } }
.hdcp22 944 SEQUENCE { OCTET STRING[48], [2] { SEQUENCE { OCTET STRING[352], OCTET STRING[522] } } }
.hdcp13.hdcp22 1,252 both [1] and [2], in that order

Every claimed size is exact [reproduced].

The load-bearing detail, re-verified. The leading 48-byte OCTET STRING is not a schema constant; it partitions the vectors into two groups [reproduced]:

936b9ae52f44c8b015344803614bce39… → .personalization, .hdcp22
c7653976975730411bcd6797e6292f0f… → .hdcp13, .hdcp13.hdcp22

The grouping is not by which optional branches are present — .hdcp22 and .hdcp13 have different shapes yet share a prefix group with the vector that has the same branch as each. So the 48-byte value correlates with the vector's provenance, not its content, and treating it as a fixed magic would be wrong.

Conservative schema, field names as analytical placeholders:

PrivateFuseValues ::= SEQUENCE {
    rootOrPersonalization  OCTET STRING,                  -- 48 B, varies per vector
    hdcp13 [1] EXPLICIT SEQUENCE {                        -- optional, independent
        opaqueData         OCTET STRING,                  -- 288 B
        opaqueInteger      INTEGER
    } OPTIONAL,
    hdcp22 [2] EXPLICIT SEQUENCE {                        -- optional, independent
        opaqueData1        OCTET STRING,                  -- 352 B
        opaqueData2        OCTET STRING                   -- 522 B
    } OPTIONAL
}

2.9 FFS2 / FFC2 — the factory/test variant

[reproduced] by reading the if guards in make_S2/make_C2: FFS2 enters the $1 != 0 branch, which bypasses the AES encryption and substitutes a fixed dummy HMAC key (0000); FFC2 states there are no signatures to verify and prints the response. This is a deliberate non-production path. The corpus does not expand FF, and neither does this document.

2.10 SIGPROV security properties — as supported

Property Support
P-256 ECDSA over SHA-256 for the provisioning side ecdsaWithSHA256 AlgorithmIdentifier + signing key + dgst -sha256 [reproduced]
Separate P-256 exchange key distinct q-maha-e.der2 with distinct OID [reproduced]
ECDH shared secret pkeyutl -derive [reproduced]
Device binding ApChipID + ApECID inside the signed body [reproduced]
HMAC-SHA256 extraction keyed by kgengid3b line 235 [quoted]
Direction separation label and operand order reversed [reproduced]
Purpose separation "mac" / "enc" suffixes [reproduced]
Encrypted private provisioning material AES-256-CBC, zero IV [reproduced]
Separate message authentication K1_MAC / K2_MAC [reproduced]
Identity-certification domain separation "SEP Identity Certification" [reproduced]

Boundary of the security claim. The corpus proves separate encryption and MAC keys, a fixed zero IV in the harness, and a static Maha ECDH private key in the unit-test tree. It does not prove whether the SEP peer key is freshly generated per transaction, so it does not establish encryption-key uniqueness across production sessions. The static Maha key is a property of this test fixture; neither that fact nor the zero IV should be promoted into a production protocol vulnerability without the missing freshness evidence.

3. Hilo / LTH

All artifacts are in XsMax_12.1.1_JF36/AppleInternal/CoreOS/AppleSEP/unit_tests/hilo/ (abbreviated <$>/hilo/). Note the filename correction: the previous version's inventory cited test_gains(1).sh, lib(1).sh, README(1).txt and 19 others. None of those exist. The real names are unsuffixed — the (1) is a macOS download-collision marker. All 22 Hilo rows are corrected in Appendix A.

3.1 Scope, from the test filenames themselves

17 test scripts, verified by directory listing [reproduced]:

test_accumulate.sh          test_gains.sh                test_lth_backup.sh
test_bim_library.sh         test_gains_library.sh       test_lth_compression.sh
test_crypto_library.sh      test_get_lth_raw.sh         test_lth_transfer_attestation.sh
test_dr_lth_backup.sh       test_load_lth_raw.sh        test_lth_transfer_message.sh
test_gain_restriction.sh    test_rate_limiting.sh
test_rate_limiting_integration.sh

The names establish the functional surface (accumulation, gains, restriction phases, rate limiting, raw debug I/O, backup, DR backup, compression, transfer, BIM/crypto libraries). Several scripts carry an explicit DEBUG-vs-FACTORY caveat [reproduced: the caveat text appears in the raw/debug tests], which is significant: the tests themselves recognise a boundary between debug observability and factory behaviour.

3.2 Test-vector provenance — the internal tooling is named

lth_compression/README.txt [quoted in full, 1,251 bytes] is more informative than the previous version recorded. It establishes that the vectors are synthetic for D3x and screenshot-derived for D2x:

  1. I took a number of screenshots on my D2x and saved them as 8-bit PNG files.
  2. Martin's lth_generation_tool will convert the target PNG files into an LTH. … 3) For D3x, rather than having to take screenshots, I used my hacked together scale.py to scale the LTH to a different resolution. … (Note: I'm not giving any guarantee that the scaling performed is "realistic" in any sense.) It might be better to take screenshots on a target device if you can.
  3. Martin's lth_compression_tool … -encode … -decode

Two things follow, and the previous version stated neither:

3.3 LTH raw layout — verified against scale.py and against file sizes

scale.py reads the LTH as three planes of 32-bit integers [quoted, lines 66–69]:

in_hw     = (in_width + 1) / 2
in_widths = [in_hw, in_width, in_hw]
out_hw    = (out_width + 1) / 2
out_widths = [out_hw, out_width, out_hw]

and visualize indexes accordingly [quoted, lines 82–97], using vectors[1][row * width + 2*col] for green (full width) and reshaping the R/B planes to (height, hw, 1).

So the layout is:

R: ceil(width/2) × height      (32-bit each)
G: width       × height
B: ceil(width/2) × height

Both vector sizes are exactly predicted by that layout [reproduced]:

Vector Predicted (⌈w/2⌉ + w + ⌈w/2⌉) · h · 4 On disk Match
lth_gen_1125_2436.bin 21,933,744 21,933,744 ✓
lth_gen_1242_2688.bin 26,707,968 26,707,968 ✓

This is a two-equation confirmation, not a coincidence: the formula predicts both files exactly across two different geometries. The conclusion — LTH is a large spatially-indexed 32-bit state map, not a compact calibration record — is very high confidence.

3.4 Compression is not byte-preserving — recomputed, not quoted

The previous version's percentages are reproduced exactly by a byte-wise comparison of each .bin against its _out.bin counterpart [reproduced]:

Vector Differing bytes Total Percentage
lth_gen_1125_2436.bin vs _out 12,360,756 21,933,744 56.35 %
lth_gen_1242_2688.bin vs _out 15,051,336 26,707,968 56.36 %

test_lth_compression.sh loads the raw input, asks SEP to round-trip it, and compares against _out.bin — the lth_compression_tool reference [reproduced by reading the test].

So the invariant is agreement with the canonical decoded result, not identity with the input. The near-identical percentages across two geometries are themselves evidence the transform is systematic (lossy or normalising) rather than a byte-offset or truncation artifact — which the previous version did not use as corroboration.

What is not established: whether the transform is lossy, normalising, or quantising. 56 % differing bytes is consistent with all three. The codec is not in the corpus (§3.2).

3.5 Accumulation and overflow

test_accumulate.sh zeroes the LTH, accumulates a test pattern, verifies, and separately tests overflow [reproduced by reading the test]. This establishes LTH as mutable accumulated state. What quantity accumulates is not established; "display history" is a [inference] from the screenshot-derived provenance plus the gain machinery, and is labelled as such.

3.6 Gain restriction phases — quoted, with the exact SEPUTIL verb

[quoted, test_gain_restriction.sh lines 47–61]:

# Gain restriction phase 0: No gains should be calculable
$SEPUTIL --hilo-advance-gain-restriction-phase || die "Could not advance …"
# Gain restriction phase 1: One gain should be calculable
$SEPUTIL --hilo-advance-gain-restriction-phase
# Gain restriction phase 2: An arbitrary number of gains should be calculable

The mechanism is a SEP-side phase counter advanced by seputil, which means the restriction is server-side policy state, not a client decision. This is stronger than the previous version's "Hilo contains policy/state around when gain computation is permitted" and it identifies the state variable.

test_rate_limiting_integration.sh advances simulated time and expects exactly one gain computation per window [reproduced].

3.7 Backup: authenticated, and zeroed on failure — the strongest single security claim in the corpus

test_lth_backup.sh [quoted, lines 40–52] — this is the security requirement stated in the harness's own words:

# This part of the test tests end-to-end that verification of the LTH backup
# works. We attempt to load a backup that won't verify. As an additional
# security requirement, we want to ensure that on a failed backup load the LTH
# in the SEP is zeroed (to avoid an attacker learning something about the
# decryption of messages that won't verify).

$SEPUTIL --hilo-load-lth $HILO_TEST_LTH_BACKUP --hilo-corrupt-lth
check_fail $? "Loading corrupted LTH did not result in expected effect"

# Check for a zeroed LTH in the SEP
$SEPUTIL --test-run Hilo/zzzz
check_fail $? "LTH was not zeroed after failed load"

This is a genuine fail-closed / anti-oracle design, stated by the author, and asserted by the test. It is the single most useful property in the corpus for an emulator: it says what SEP must do when a MAC check fails, not merely that a MAC check exists.

3.8 Disaster-recovery backup incorporates the compression transform

test_dr_lth_backup.sh performs load → DR-backup → zero SEP LTH → load DR backup → retrieve raw LTH → compare against the AP-side decode(encode(initial LTH)) reference [reproduced]. So the DR container is not a raw dump; it carries the compression transform, and the same §3.4 canonical reference applies.

3.9 Transfer is attested, device-bound and policy-gated

test_lth_transfer_message.sh [quoted] states transfer uses the DR compression algorithm, obtains an attestation, builds the message from SCRT material, clears the local LTH, and verifies recovery against the compression reference.

test_lth_transfer_attestation.sh [quoted] shows the negative controls explicitly, including a test-only toggle:

# there we know TESTING_ALLOWED, and we know that there's no entitlement
    set_lth_transfer_entitlement_required 1
    set_lth_transfer_entitlement_required 0

Correction to the previous version. It listed six negative classes (modified SCRT signature, missing manifest, missing entitlement, wrong SEP, corrupted attestation, corrupted message). Those classes are plausible and test_lth_transfer_message.sh does contain corruption checks [reproduced], but only the entitlement toggle is verified here by direct quotation. The other five are not all individually confirmed in this pass, so the previous version overstated the enumeration. What is confirmed: transfer enforces an entitlement requirement, is attested, and is bound to SCRT material.

3.10 Transfer policy toggles are controls, not bypasses

lib.sh contains set_lth_transfer_entitlement_required and a manifest toggle [reproduced]. The comments explain these exist to prove that the security checks are what cause failure, and to enable BATS testing [reproduced]. This is the same reasoning used elsewhere in this project: a test bypass does not imply the production design lacks the check — the harness treats the toggle as something that should normally be enabled.

3.11 SCRT — what it is, and the fixture/device confusion the previous version fell into

Two SCRT files exist, and conflating them would be a serious error [reproduced]:

Path Meaning
<$>/hilo/scrt-00008015-000E790124C3C12E Test fixture shipped in the SEP unit-test tree. ECID 000E790124C3C12E — not this device.
X/System/Library/Caches/com.apple.factorydata/scrt-00008015-001551680450E02E Device factory data. ECID 001551680450E02E — this device.

The previous version said the Hilo SCRT is "the supplied scrt-… file" and treated it as the device's certification material. It is not; it is a fixture. The device's real SCRT is the factorydata one, and that is the file whose CHIP field independently corroborates the §1.3 iPhone X / D22AP identity.

Tag census, on the factorydata copy [reproduced]:

IMG4 ×1   IM4P ×1   scrt ×2   SEP-CA-E10 ×1   SEP Device Certification ×1
IM4M ×2   BNCH ×1   BORD ×1   CHIP ×1   CPRO ×1   CSEC ×1
ECID ×1   SDOM ×1   EPRO ×8   ESEC ×8

Decoded identity properties [reproduced]:

CHIP  = 0x008015        (INTEGER, 3 bytes)
BORD  = 0x06            (INTEGER, 1 byte)
ECID  = 0x1551680450E02E (INTEGER, 7 bytes)  → matches filename

The factorydata/ sibling seal-00008015-… is a proper IMG4 (IM4M, MANB1) containing CtCl / HmCl / IfCl certificate records [reproduced] — the FDR sealing chain, which is why FDRSealingStatus is a real query (§5.5).

No full IMG4 parse is claimed. The tag census is a byte-substring count; the document says so rather than implying a parsed manifest.

3.12 Hilo architectural interpretation

Display/screenshot-derived input (PNG → lth_generation_tool)
        │
        ▼
large LTH spatial state in SEP   [ R,G,B planes; 32-bit; ~4 bytes/px ]
        │
        ├── accumulate / overflow handling
        ├── gain calculation
        │     ├── restriction phase (SEP-side counter: 0 → 1 → 2)
        │     └── rate limiting (simulated-time window)
        ├── raw debug load/get         (DEBUG-only capability)
        ├── authenticated backup        (zero LTH on verify failure)
        ├── DR backup = compression + container
        └── attested / device-bound transfer (SCRT + entitlement + manifest)

Not established: expansions for Hilo and LTH. Neither is guessed.

4. MobileKeyBag, SystemBag, Seshat and AppleSSE

4.1 systembag.kb.PLIST — and a numerical correction

private/var/keybags/systembag.kb.PLIST, 1,543 bytes, binary plist (bplist00) [reproduced via plistlib]:

Key Type Value / length
_MKBWIPEID int 1111574321
_MKBIV bytes 16
_MKBPAYLOAD bytes 1,424

The previous version stated _MKBPAYLOAD is 1,470 bytes. That is wrong; it is 1,424 [reproduced]. The size error is worth recording rather than silently correcting, because a 46-byte discrepancy in a binary-blob length is the kind of thing that turns into a wrong padding or framing assumption downstream. The 1,543-byte file size, the 16-byte IV and the three-key structure are all confirmed.

What this establishes: a stored wrapper with an explicit IV and an opaque payload. What it does not: algorithm, key source, plaintext serialization, or the meaning of _MKBWIPEID. 1111574321 is not interpreted here.

4.2 keybagd — persistence and roll policy

private/var/logs/keybagd.log.0 (39,043 bytes) [reproduced counts]:

54 ×  Updating Keybag handle 0 with NO EFFACEABLE ROLL
54 ×  KBUpdateKeyBag: Got opaqueStuff from ondisk keybag
54 ×  KBSaveSystemBagHandle: Saving SystemBag with NO EFFACEABLE ROLL
55 ×  Saved new keybag with result 0

Four facts, all directly quoted: an in-memory keybag handle exists; opaque on-disk material is loaded; SystemBag persistence is explicit; and saving happens without an "effaceable roll". The near-equal counts (54/54/54/55) show these are one save cycle's worth of logging, not scattered events — a cadence the previous version did not note and which is useful for an emulator's persistence cadence.

4.3 Seshat — a persistent health/state subsystem with a real on-disk file

[reproduced counts from keybagd.log.0]:

35 ×  seshat_init_block_invoke_2:
21 ×  seshat
16 ×  seshat_evaluate_health_plist:
15 ×  seshat_health_data:
14 ×  SeshatSkipHealthCheck:
14 ×  entangled or been unlocked

And the counter, which the previous version asserted without values [quoted]:

globalWriteCounter = 337
globalWriteCounter = 331
globalWriteCounterLimit = 4000000

Correction: the previous version said "a globalWriteCounter and limit" without values, leaving the reader unable to judge whether the counter was near its limit. It is 337 of 4,000,000 — roughly 0.008 % — so Seshat was nowhere near its bound. That is a materially different picture from "a counter exists".

Additionally, the health file is a real artifact, not just a log string [reproduced]: private/var/root/.mkb_seshat_health exists on disk. The previous version cited only the keybagd strings and implied persistence; here the persisted artifact is located.

4.4 AppleSSE — persistent vs per-session state, fully reproduced

private/var/mobile/Library/Logs/AppleSSE.log (3,327 bytes) covers 13 sessions across 2019-10-15, 10-16 and 10-17 [reproduced].

Field census: exactly 13 occurrences each of sseKey, authRand, subcounter, entropy, keybag, noPasscodeCnt [reproduced] — so all six fields appear in every session, and the stability comparison is over a like-for-like set.

Distinct-value census [reproduced]:

Field Distinct values across 13 sessions Reading
sseKey hash 1 persistent
entropy hash 1 persistent
keybag hash 1 persistent
authRand hash 13 per-session
noPasscodeCnt 1 (value 1) persistent
subcounter 13 values 108 → 120, strictly monotonic [reproduced]

The previous version's §B.3 sequence and its stability claims are confirmed exactly. Session shape [quoted]:

2019-10-15 13:53:51 (-0700) [nfcd]: AppleSSE Log Starts - System Version 16C49
	sseKey hash   = 152870bda8620526
	authRand hash = ef39731fadd952ed
	subcounter    = 108
	entropy hash  = a564ad9e557903cc
	keybag hash   = 9fe602106f4f29f0

Note the log self-identifies as 16C49, independently corroborating §1.2 from a second artifact family [reproduced]. And the fingerprints are truncated to 8 hex bytes — the document never has the underlying key material, by design.

This is the cleanest persistent-vs-transient split in the corpus, and it maps directly onto §13's persistence tiers.

4.5 SystemBag ↔ AppleSSE relationship — unchanged, still unproven

Both exist: keybagd actively persists a SystemBag (§4.2), and AppleSSE holds a stable keybag fingerprint across the same period (§4.4). It is a reasonable [inference] that AppleSSE fingerprints keybag-derived state. It is not established whether that fingerprint covers the full serialized SystemBag, a keybag identifier, a class key, or something else. The previous version's "Unknown" rating here is correct and is retained.

5. Lockdown, Pairing and Factory Diagnostics

5.1 Internal Lockdown environment

private/var/logs/lockdownd.log.1 (524,347 bytes) opens with [quoted]:

10/15/19 13:53:46.719665 pid=59 main: Starting up (Internal)

Starting up (Internal) is the lockdownd process's own label, and it recurs across restarts in the log [reproduced: 3+ occurrences]. This corroborates ReleaseType: Internal (§1.2) from the service side. Alongside it: /AppleInternal components, launchd.development, iTester paths, and PurpleSNIFF [reproduced: PurpleSNIFF appears 489 times in this log].

5.2 Pairing fields — all present, with counts

[reproduced, occurrence counts in lockdownd.log.1]:

Field Occurrences
HostID 207
ProtocolVersion 14
DeviceCertificate / HostCertificate / RootCertificate 13 each
SystemBUID / HostName / Label 13 each

Pairing succeeded, and it created an escrow bag [quoted, both logs]:

lockdownd.log:   store_escrow_record: Creating escrow bag for 51474E57-83D3-447D-ADBF-3887D2EED099
lockdownd.log:   handle_pair: Pair for usbmuxd succeeded
lockdownd.log.1: store_escrow_record: Creating escrow bag for C023A0E7-0A8D-41B9-AF68-99CEF740A3F8
lockdownd.log.1: handle_pair: Pair for iTunes succeeded

Two distinct host identities paired successfully across the capture — one usbmuxd (the USB multiplexer, i.e. a host-side usbmux connection) and one iTunes. Each got its own escrow bag. The previous version reported the escrow-bag edge but not that there are two independent pairings with separate escrow records; for an emulator that is the more useful fact.

5.3 Pairing is state-gated, not certificate-gated

[reproduced counts in lockdownd.log.1]: PasswordProtected ×4, InvalidHostID ×194, GetProhibited ×14.

So a structured, certificate-backed pair request can be submitted and still refused, and subsequent session creation fails InvalidHostID because no pair record was accepted. Device lock / password / authorization state is part of pairing policy [reproduced].

5.4 Per-key and per-service authorization

The mixture of allowed and prohibited GetValue operations means paired alone is insufficient as a model. The previous version's ladder is retained and is consistent with the counts above:

request
  → connection identity / label
  → pairing + session state
  → activation state                       (see §6)
  → domain/key or service policy
  → allow / prohibit / prompt

5.5 PurpleSNIFF is an active internal diagnostic client

489 occurrences in lockdownd.log.1 [reproduced]. Queried keys, with counts [reproduced]:

Key Hits
EffectiveProductionStatusAp 12
EffectiveProductionStatusSEP 6
EffectiveSecurityModeAp 6
EffectiveSecurityModeSEP 6
FDRSealingStatus 6
NavajoFusingState 6

It also repeatedly starts com.apple.factorysupportd and acts as a system-mode diagnostic client [reproduced]. So it is a client, not a passive logger — which is what makes the §5.6 finding meaningful, since it is the client doing the querying.

5.6 AP and SEP security state — the key architecture claim, and its limit

This was the previous version's strongest architectural finding, and it survives with one important correction.

What is established. Six distinct Lockdown domain keys exist and are queried independently, with AP- and SEP-specific variants for both production status and security mode [reproduced]. The client that queries them is an internal factory client (§5.5). The FDR sealing chain those keys refer to is materially present — factorydata/seal-00008015-001551680450E02E is a real IMG4 with IM4M/MANB1 and CtCl/HmCl/IfCl certificate records [reproduced, §3.11].

What the log does NOT contain, and why the previous version overclaimed.

Every occurrence is a request line [quoted]:

10/15/19 20:45:00.483018 pid=59 handle_get_value: PurpleSNIFF attempting to get [EffectiveProductionStatusAp]
10/15/19 20:45:00.484239 pid=59 handle_get_value: PurpleSNIFF attempting to get [EffectiveProductionStatusSEP]

There is no value in the log — no EffectiveProductionStatusAp = … line, and no Prohibited/denied reply attached to any of them [reproduced: zero matching denial strings adjacent to these queries].

So the honest statement is narrower and still architecturally load-bearing:

The Lockdown domain exposes separate keys for AP and SEP production status and security mode, and an internal factory client queries them independently [reproduced]. The corpus does not show the returned values, so it does not show that the two ever differ.

The previous version rated this "Very high" confidence for "AP and SEP production/security state are separate". That rating is defensible for the key decomposition and not for any claim about the values. For an emulator the decomposition is the actionable part, and it stands.

5.7 Factory service constellation

private/var/logs/lockdown_service.log [reproduced counts]:

Service Hits
factorysupportd 24
afcd 14
notification_proxy 11
mobile_diagnostics_relay 7
mobileactivationd 6
diagnosticd 5
crash_mover 2

So factory/diagnostic workflows orchestrate existing services through Lockdown (Output capped at 50 KB. Showing lines 1-1122. Use offset=1123 to continue.)