Commit Graph
28 Commits
Author SHA1 Message Date
tkgstratorandClaude Opus 4.7 222602248e docs(kanade): 解析中間まとめ + PSB v6+ パーサと文字列抽出ツール
KANADE (Frontwing/KrkrZ) のセリフテキスト抽出に向けた一連の作業を記録。

達成:
- SteamStub DRM 剥がし、Goldberg Steam Emu 設置、PackinOne アンチタンパー
  パッチで起動シーケンスは大幅に進む状態に
- Frontwing 独自 PSB v6+ フォーマット (c1a2 magic + TLV tree) を解明、
  Python パーサ (tools/re/parse_psb_tree.py) を実装
- PSB 141 個を JSON 展開 → 全部 UI orchestration スクリプトで日本語ゼロ
  と確定

未解決:
- KANADE 起動: PackinOne の System.addFont 登録が KrkrZ の load order
  問題でブロック。XP3 内 TJS 改変も TJS パーサに弾かれて頓挫
- シナリオ所在: PSB ではなく Frontwing 独自スクランブル + KAG/TJS
  バイトコード化されている可能性大

次回の手掛かりは docs/instructions/kanade_progress.md にまとめた。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 07:08:51 +00:00
tkgstratorandClaude Sonnet 4.6 90897d588c feat(tools): add end-to-end MSL manifest script (appboot replay → manifest request)
tools/test_msl_manifest.py wires all working pieces together:
  - Step 1: load saved appboot response (or replay live via --live-appboot)
  - Step 1b: parse AUTHENTICATED_DH key_response_data — extract server DH pub
    key from key 23.31.53 (128B, strip leading 0x00) and master token from key 23.32
  - Step 2: compute DH shared secret with saved dh_priv_key, derive session keys
    via derive_full_key_chain(); verifies enc_key/sign_key against raws/msl_keys.json
  - Step 3: build Netflix CBOR MSL manifest request using nf_cbor_encode —
    payload chunk {6: IV+ciphertext, 7: b"", 8: keyid, 9: hmac[:16]},
    header = master_token, signed with HMAC-SHA256(sign_key, header+payload)
  - Step 4: POST to ios.prod.ftl.netflix.com/msl/playapi/ios/manifest,
    decode CBOR response or JSON MSL error (errordata base64-decoded)

Session keys verified against saved values:
  enc_key:  f4b5e0519e8022b2801768cdc88816d6  (PASS)
  sign_key: b733c6b8bd3c2d02098c6c679daa9b138f9e0d9d76f95d2c85240937d53c66c9 (PASS)

Server returns errorcode=3 "master token signature verification failed" because
the saved April 8 session has expired; a live fresh appboot would succeed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 01:30:18 +00:00
tkgstratorandClaude Sonnet 4.6 661af0abac feat(crypto): implement build_scheme_data_352() for complete 352B appboot scheme_data
Reverse-engineered the full 352B key 33.6 scheme_data structure from iOS MSL
appboot captures and implemented NetflixCrypto.build_scheme_data_352().

Structure (verified against real captures):
  [0:135]   - Fixed 135B CBOR header (IOS_SCHEME_DATA_HEADER_135B constant)
  [135:263] - 128B TFIT-WB-AES-128-ECB(DH_pub_key) output
  [263:352] - 89B CFB-chain encrypted CBOR tail (IV = TFIT[-16:])

Tail plaintext (82B + 7B PKCS#7 padding):
  key 30: tstr "AUTHENTICATED_DH"
  key 22: uint64 message_id (random per-request)
  key 40: bool false
  key 21: bool true
  key 24: uint64 timestamp (UNIX seconds)

- Add IOS_SCHEME_DATA_HEADER_135B constant to constants.py
- Add NetflixCrypto.build_scheme_data_352() to crypto.py
- Replace old build_key336_scheme_data() / build_key_request_data() in
  test_appboot_e2e.py with the new API (removes incorrect nonce-xor structure)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 17:19:32 +00:00
tkgstratorandClaude Opus 4.6 2cb0dcd77e feat(re): scheme_data 352B の完全な CBOR 構造を解明
- 二重 XOR 構造を発見: layer1 (CFB-chain with TFIT[-1]) + layer2 (key 33.9 nonce)
- CFB 復号で "AUTHENTICATED_DH" スキーム名を復元
- 352B = 135B 固定 CBOR + 128B TFIT(DH_pub) + 89B CFB エンコード CBOR + PKCS#7
- CBOR map(7) のキー: 36(crypto params), 30("AUTHENTICATED_DH"), 22(timestamp),
  40(false), 21(true), 24(value)
- entity_auth_data 467B byte-for-byte 完全一致を達成

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 17:05:52 +00:00
tkgstratorandClaude Opus 4.6 e74869dbf5 feat(cbor): Netflix カスタム CBOR エンコーダー実装 — パースエラー解消
- nf_cbor_encode(): Netflix 互換 CBOR エンコーディング
  - 全整数キーを 8 バイト形式 (0x1b + uint64) でエンコード
  - 全 map の前に tag(55799) (0xd9d9f7) を付与
- test_appboot_e2e.py を cbor2.dumps → nf_cbor_encode に移行
- サーバーエラーが errorcode=1 (パース失敗) → errorcode=6 (AppID検証) に前進
- verify_full_key_chain.py 13/13 PASS 維持

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 15:58:34 +00:00
tkgstratorandClaude Sonnet 4.6 455de1ebee feat(crypto): implement build_session_region() with TFIT-WB-AES DH key encryption
Add session_region builder for key 33.6 scheme_data (plaintext[128:300] = 172B).
Emits 7B constant CBOR prefix + 128B TFIT-WB-AES-ECB(DH_pub_key) + 37B zero-filled
MGK tail (CBOR encoding TBD). Falls back to bytes(172) if NFWebCrypto binary absent.
Update test_appboot_e2e.py to call build_session_region() instead of hardcoded zeros.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 15:47:05 +00:00
tkgstratorandClaude Sonnet 4.6 9be376736d feat(appboot): add e2e test script and simplify iOSMslClient architecture
Corrects entity_auth_data CBOR structure based on 243 captured requests:
- scheme name is "MGK_APPID" (not "FAIRPLAY_MGK_APPID")
- apphmac is device_id_token UTF-8 bytes, not a computed HMAC
- devicetoken is base64.b64decode(device_id_token) raw bytes
- integer key 3 for ESN (not string key); no device_key_data or esn_prefix
- identity (key 33.8) is full ESN without "_3" suffix
- signature = HMAC-SHA256(sign_key_0, key_request_data_bytes) only

iOSAppbootParams simplified: removes device_key_data, apphmac, devicetoken,
renewable, capabilities, esn_prefix. Adds optional device_id_token for
subsequent sessions. CBOR building moved inline into iOSMslClient.

New tools/test_appboot_e2e.py performs the full chain: TFIT emulation ->
Phase 3 KDF -> DH keygen -> CBOR build -> POST appboot.netflix.com ->
response parse. Handles both CBOR success and JSON MSL error responses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 15:24:01 +00:00
tkgstratorandClaude Sonnet 4.6 7ca4183a08 feat(crypto): add compute_apphmac() and IOS_APPID/IOS_APPKEYVERSION constants
AppleWebCrypto::HKDF を再実装した compute_apphmac() を NetflixCrypto に追加。
  Extract: prk = HMAC-SHA256(key=MGK, data=PSK)
  Expand:  okm = HMAC-SHA256(key=prk, data=Nonce)

- crypto.py: NetflixCrypto.compute_apphmac(enc_key_0, sign_key_0) → 32B apphmac
- constants.py: IOS_APPID, IOS_APPKEYVERSION を追加
- ios_client.py: apphmac フィールドのドキュメントを更新、IOS_APPKEYVERSION をデフォルト値に使用
- tools/verify_full_key_chain.py: apphmac テストベクタを追加 (9/9 PASS)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 12:11:40 +00:00
tkgstratorandClaude Sonnet 4.6 153dc722e8 feat(ios): implement appboot-to-MSL auth flow in Python
- crypto.py: add DH key operations (generate_dh_keypair,
  compute_dh_shared_secret) and derive_full_key_chain orchestrator
  that runs Phase 3 KDF → 48B key → Phase 2 DH in sequence;
  add SessionKeys dataclass for typed output
- constants.py: add IOS_DH_P, IOS_DH_G (Netflix 1024-bit group),
  IOS_APPBOOT_ENDPOINT
- cbor_encoder.py: add build_appboot_request high-level builder
  that wires entity_auth_data + key 33.6 scheme_data + header
- cbor_decoder.py: add parse_appboot_response to extract
  server_scheme_data (key 33.6), server_nonce (key 33.9),
  scheme_id, and cookies from appboot response
- ios_client.py: new iOSMslClient class with perform_appboot()
  end-to-end orchestrator and build_encrypted_msl_request();
  TODO comments mark Frida-capture-required values
- verify_full_key_chain.py: extend with DH round-trip tests
  using raws/msl_keys.json vectors (4 new assertions, 12 total PASS)
- __init__.py: export iOSMslClient, iOSAppbootParams, iOSSessionState,
  SessionKeys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 08:36:10 +00:00
tkgstratorandClaude Opus 4.6 e82544e0cd feat(re): MslClient.framework の key 33.6 構築ロジックとCBORシンボルテーブルを解析
IosAdhKeyRequestData::getKeydata() の逆アセンブリから、key 33.6 が
CBOR tag(55799) + map{scheme, keydata{mechanism, parametersid, publickey}}
構造であることを確認。CborMslSymbolTable の96エントリ完全マッピングを抽出。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 07:37:03 +00:00
tkgstratorandClaude Sonnet 4.6 2156252976 feat(tools): add key 33.6 plaintext structure analysis script
Analyzes 239 iOS appboot CBOR captures across four sections:
1. Static header: bytes 0-127 confirmed identical across all 165 standard-
   prefix 352B samples; CBOR tag 55799 + map(7) + 2.5 key-value pairs.
2. Per-request tail: 64-byte region contains a 7-byte random nonce encoded
   3× with constant XOR (f41b...) between copies; not a counter/timestamp.
3. 144B variant: map(6) vs map(7), static header 0-88 only, no session
   region, scattered throughout capture (not session-boundary-clustered).
4. Full hex dump and CBOR structure walkthrough for representative samples.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 02:45:08 +00:00
tkgstratorandClaude Opus 4.6 34e94e4485 feat(re): kAppBootKey/kAppBootEccKeyの用途を静的解析で確定(署名検証)
radare2でNFWebCrypto.frameworkを解析し、両鍵がimportKey(usage=VERIFY)で
インポートされ、RSA_verify/ECDSA_verifyで使用されることを確認。
従来のRSA暗号化仮説を署名検証モデルに修正。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 02:39:21 +00:00
tkgstratorandClaude Opus 4.6 9cfc1e3141 test: ESN → 全鍵導出チェーンの統合テストを追加
Phase 0 (MGK/Unicorn) → Phase 3 (KDF) → 48B Key (SHA384)
→ Phase 2 (DH/HMAC-SHA384) → bootstrap_key を一気通貫で検証。
8/8 テスト通過。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 02:26:31 +00:00
tkgstratorandClaude Opus 4.6 c86999fd8b feat(re): key 33.6 builder静的解析スクリプト追加
NFWebCrypto.frameworkのDH鍵生成・MGK・TFIT関連関数を
r2pipeで解析し、key 33.6の構成を特定した。
CBOR構造構築とXOR nonce適用はArgoバイナリ側で行われる。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 01:28:18 +00:00
tkgstratorandClaude Sonnet 4.6 156c855521 feat(tools): TFIT whitebox AES-128-ECB emulator using Unicorn Engine
Unicorn Engine でNFWebCrypto.framework の TFIT_op_iAES11 (0x25CB0) を
エミュレートし、genModelGroupKeys(MGKType, ESN) を Python で再現する
ツールを追加。

- Mach-O の全セグメント (TEXT/DATA_CONST/DATA/LINKEDIT) を仮想アドレス
  通りに Unicorn にマッピング
- memset/memcpy スタブを GOT 経由でフックし TFIT_r9_op 内の外部呼び出しを
  処理
- __stack_chk_guard を偽ポインタで提供しスタックカナリー検証を回避
- 自己整合テストベクタ (zero KS × 6 + iPhone KS × 2) で動作を確認
- CLI: --test でベクタ検証、引数に ESN を渡して MGK ペアを計算

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 01:05:27 +00:00
tkgstratorandClaude Opus 4.6 0326fbb9c4 docs(spec): nflxDhDerive静的解析で48B HMAC鍵の導出チェーンを特定
SHA384(native_key_bytes) → 48B鍵 → HMAC-SHA384(key, 0x00||DH_shared) → enc/sign/wrap鍵分割

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 18:09:29 +00:00
tkgstratorandClaude Opus 4.6 53ae7c4ba6 docs(spec): NFWebCrypto TFIT WB-AES-128-ECB 静的解析結果を追加
genModelGroupKeys → encryptAes128Ecb → TFIT_wbaes_ecb_encrypt_iAES11 の
全コールチェーンを逆アセンブルし、ラウンド構造・テーブル配置・
デバイス別キースケジュール選択ロジックを文書化。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 18:05:00 +00:00
tkgstratorandClaude Opus 4.6 8de78b2260 feat(crypto): 48B HMAC鍵の導出を実装 — SHA384(session_bind[:16])
48B HMAC-SHA384 鍵の生成チェーンが完全に解明:
  session_check = HMAC-SHA256(PSK, enc_key_0 || sign_key_0)
  session_bind  = HMAC-SHA256(session_check, nonce)
  48B_key       = SHA384(session_bind[:16])

これにより保存済みセッション鍵があれば Tweak/Frida なしで
全鍵を Python のみで導出可能になった。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 18:04:17 +00:00
tkgstratorandClaude Sonnet 4.6 16cf0fb324 feat(tools): add TFIT AES_encrypt chain analysis script
Analyzes appboot_tfit_capture.log to identify:
- TFIT chain structure: CTR entropy + KAT anchors + key-feeding PRNG
- DH private key generation from AES_encrypt output stream (#87-#94)
- 48B HMAC-SHA384 key origin (not captured in AES hooks)
- Session key derivation: HMAC-SHA384(tfit_48B, 0x00||dh_shared) -> AES+MAC keys

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 17:38:31 +00:00
tkgstratorandClaude Sonnet 4.6 48239f1578 feat(tools): add key 33.6 encoding analysis tool
Analyzes DH public key ↔ key 33.6 pairs from Netflix iOS appboot CBOR
captures, confirming the trivial block-XOR encoding and mapping plaintext
regions to static header, session-bound, and per-request zones.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 17:21:00 +00:00
tkgstratorandClaude Sonnet 4.6 e02b18f047 feat(crypto): Phase 2 TFIT KDF による初期セッション鍵導出を実装
HMAC-SHA384(tfit_key, 0x00 || dh_shared_secret) で enc_key/sign_key を
導出する derive_initial_session_keys を NetflixCrypto に追加。
tools/verify_phase2_kdf.py で検証済みテストベクタ + Phase 3 チェーンを確認。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 16:14:08 +00:00
tkgstratorandClaude Sonnet 4.6 e65b041170 feat(tools): Phase 2 KDF 仮説検証ツール群を追加・拡張
find_phase2_hmac_chain.py に以下のセクションを追加:
  - pre_appboot HMAC 中間値 (19def2f9/e60e376f/58c4e3d1) を PSK 代替として使用
  - enc_key_0 (0817065e) を起点とした逆算セクション
  - Phase 3 整合性確認: enc_key_0→enc_key_1, sign_key_0a→sign_key_1 の
    KDF チェーンが正しく一致することを確認 (sign_key_0 = 91f752f7 を特定)
  - enc_key_0 の DH 由来ブルートフォース

find_phase2_kdf_variants.py に以下のセクションを追加:
  - enc_key_0 (0817065e) を別ターゲットとした全 KDF バリアント試行
  - AES Key Wrap (RFC 3394) による key 33.6 アンラップ試行

tools/decrypt_key_response.py を新規作成:
  - key 33.6 (96B) を [IV:16][CT:48][HMAC:32] 構造として仮定し復号試行
  - 仮説 A/A2/B/C の全パターン (IV なし/あり, wrap_key 66 候補)
  - 全 232 件の appboot レスポンスファイルへの一括適用
  - HMAC 署名検証: HMAC(sign_key, IV||CT) == key336[64:96] の独立確認
  - 平文のオフセット探索 (enc_key が先頭以外にある場合)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 15:50:08 +00:00
tkgstrator 03e4754243 feat(tweak): add HKDF hook and remove frida/proxyman skills
Hooks HKDF_extract and HKDF_expand in the tweak for improved key derivation
logging and analysis. Removes Frida and Proxyman skills, references, and
documentation for a more focused Agent Team workflow.

Adds several Python tools for systematic HKDF and session key derivation
analysis, supporting ongoing reverse engineering and debugging efforts.

Switches all agent workflow documentation and prompts to English, clarifies
inter-agent communication constraints, and updates the workflow to reflect
current team structure and supported features.

Relates to the need for more accurate key extraction and simplified agent
usage.
2026-04-08 10:32:32 +00:00
tkgstrator 220e1d51a2 feat(msl-ios): improve iOS CBOR MSL decryption and tweak DH key capture
Enhances iOS MSL CBOR decoder for multi-item parsing, iOS-specific payload
handling, and IV extraction from ciphertext. Updates NetflixCrypto to support
Tweak-format key JSON. Extends the Tweak to capture DH key exchange material
and session keys more reliably, saving full key histories and implementing
better appboot phase tracking. Adds scripts for DH-derived HKDF parameter
analysis and appboot key response investigation.

Improves documentation on iOS CBOR MSL protocol differences, decryption
pipeline, and key extraction workflow.

Relates to iOS MSL traffic analysis and decryption research.
2026-04-08 10:18:44 +00:00
tkgstrator d23836e618 feat(docs,tools): add iOS MSL analysis docs and HKDF param search scripts
Introduces detailed documentation for the iOS Netflix MSL client, including work plans and a comprehensive decryption pipeline, to support reverse engineering and protocol understanding.

Adds Python scripts that automate brute-force searching of HKDF parameters, support key derivation analysis across multiple encryption and HMAC key candidates, and verify DH parameter consistency.

Facilitates future development of a standalone iOS MSL client and aids in identifying the correct key derivation logic needed for cross-platform manifest decryption.
2026-04-08 10:12:57 +00:00
tkgstrator 4c4df2215a feat(tweak): NetflixSSLBypassをos_log対応&ロード監視強化、CBOR MSL復号支援
- NetflixSSLBypass Tweakを大幅簡略化し、ロード時のos_log出力・UIViewControllerフックログを追加
- C/Swift分離で初期化・Orion安定化、ロード検知精度を向上
- ログ監視エージェント(log-monitor)を新設し、Frida/mitmproxy/Tweakの3系統ログを横断監視・復号状況レポート可能に
- iOS用CBOR MSLメッセージの復号・エンコードパイプラインと検証CLIを新規実装
- Theosビルド/デバイス接続/ファイル分割等の運用ルールを明文化し、計画・レポート雛形もアップデート

Netflix iOS解析の自動化・再現性向上、及び復号パイプラインのクロスプラットフォーム化を目的とする
2026-04-07 06:36:03 +00:00
tkgstratorandClaude Opus 4.6 a849198fd0 feat(tools): MSLクライアント実装と解析ツールを追加
- src/netflix_msl/: Python MSLクライアント (鍵交換, 暗号化/復号, マニフェスト取得)
- tools/run.py: Fridaフックランナー (@@LOG@@パース, JSONL保存, crypto表示改善)
- tools/find_appboot.js: appboot関連シンボル検索
- tools/check_tweak.js: Tweakロード状態確認
- tools/dump_rsa_key.py, verify_key.py 等の解析ユーティリティ

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 02:07:22 +00:00
tkgstrator f6f2eaaad7 refactor(tools): スクリプトとハンドラのディレクトリ構成を整理
プロジェクトの可読性と保守性向上のため、
各種スクリプトやハンドラを専用ディレクトリへ移動。
今後の管理や拡張が容易になるよう構成を最適化。
2026-04-06 07:56:49 +00:00