mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:45:22 +00:00
[GH-ISSUE #7038] [Feature] Read Hermes bytecode bundles: header, integrity, function and string tables #4258
Open
opened 2026-10-31 00:48:11 +00:00 by bsakaguchi
·
12 comments
No Branch/Tag specified
main
codex/procedure-reference-stacked
release-please--branches--main--components--rea-agents
release-please--branches--main--components--rea-agents--release-notes
codex/kuna-independent-retry
codex/byte-search-overlay-coverage
codex/open-failure-target-receipt
codex/kuna-xref-evidence
codex/ghidra-ambiguous-procedure-recovery
codex/function-source-bundle
codex/trace-function-integration-prototype
codex/snapshot-source-closure
codex/recorded-evidence-array-pages
codex/evidence-recovery-redesign
codex/trace-feature-address-scope
codex/call-discovery-scope
codex/ghidra-literal-candidate-evidence
codex/decompile-directory-independent-retry
codex/retry-provenance-base
codex/value-flow-capability-experiment
codex/ghidra-containing-instruction
cursor/readme-discord-button-ef9f
dependabot/github_actions/actions/setup-node-7.1.0
dependabot/github_actions/actions/upload-artifact-7.0.2
dependabot/npm_and_yarn/npm-minor-and-patch-d8d97ce6df
codex/kuna-1989
fix/8559-native-ui-fixture-ownership
fix/8555-go-verifier-mcp-ownership
codex/provider-capability-recovery
fix/8642-rizin-target-stdin
codex/ghidra-memory-effect-scope
codex/ghidra-annotation-entry-selector
codex/ghidra-readonly-recovery
codex/ghidra-regex-verifier-recovery
codex/evidence-discovery-view-guidance
fix/8545-bulk-append-overflow
fix/8428-navigation-refusal-alternatives
codex/address-context-recovery
codex/matching-member-limitations
codex/unknown-scope-contract
codex/evidence-view-guidance
feat/8373-native-trace-views
codex/ghidra-snapshot-verifier-binding
codex/elf-export-visibility
codex/evidence-view-recovery
codex/native-reference-cli-help
codex/provider-candidate-observation-scope
codex/kuna-session-verification
codex/ghidra-switch-lifetime-guidance
codex/pseudocode-paging-discovery
codex/clarify-evidence-view-support
codex/kuna-xrefs-selector-recovery
codex/context-capacity-recovery
codex/evidence-closure-large-links
codex/same-function-evidence-identity
codex/ghidra-verifier-inspected-jdk
codex/audit-guided-workflows
codex/crash-prompt-retained-dossiers
codex/analysis-view-error-recovery
codex/kuna-verifier-target-selection
codex/ghidra-selected-project-call-coverage
codex/docs-native-analysis-scope
codex/ghidra-java-socket-boundary
codex/ghidra-retained-snapshot-verifier
codex/ghidra-search-inventory-facts
fix/8284-zero-argument-parameter-bindings
fix/8198-ui-action-handler-offset
fix/8257-elf-entry-label-identity
fix/8304-deferred-output-schema-projection
fix/8277-call-path-computed-target-uncertainty
fix/pr-8089-conflicts
fix/ci-static-duplicate-export
dependabot/npm_and_yarn/lint-staged-17.6.0
dependabot/github_actions/actions/download-artifact-8.0.2
dependabot/npm_and_yarn/write-file-atomic-8.0.0
dependabot/npm_and_yarn/canonicalize-5.1.0
dependabot/github_actions/actions/cache/restore-6.1.0
dependabot/npm_and_yarn/toon-format/toon-4.4.0
dependabot/github_actions/actions/deploy-pages-5.0.1
codex/review-fixes-pr-2403
codex/review-fixes-pr-2400
codex/process-terminal-width
codex/test-brittleness-cleanup
verify/7167-browser-connect-macos
fix/7167-browser-connect
feat/native-matching-allowance-setting
feat/browser-scenario-dry-run
test/managed-caller-parameters-20261024
codex/parser-fortythird-boundaries
fix/6926-pinvoke-platform-decorations-20261023
fix/6889-har-body-encoding-20261023
fix/6888-sqlite-schema-budget-20261023
fix/dependency-security-gates-6708
cursor/evidence-overwrite-rebase-b4ac
feat/4057-verify-native-exports
fix/windows-acl-observer-overhead-20261022
cursor/erlang-beam-restack-4476
cursor/pe-certificate-review-bf32
fix/6116-javascript-application-fs-errors
fix/6061-unmapped-runtime-script-unknown
feat/browser-scenario-summary
fix/pe-certificates
codex/verify-3407
cursor/rebase-5699
cursor/rebase-5352
cursor/rebase-5600
cursor/fix-cli-schema-omission-10a8
codex/audit-hopper-shutdown-reasons-20261021
fix/demangle-swift-omitted-record
fix/nib-boolean-value-types
cursor/cancellation-partial-observation-a5ac
fix/ib-object-limit-reasons
fix/electron-fuse-limit-advice
fix/kuna-doctor-dangling-cache
fix/fixed-budget-refusal-advice
fix/js-ipc-listener-dedup
fix/js-return-member-provenance
fix/dmg-integrity-retry-advice
fix/ida-doctor-readiness
fix/kuna-version-probe-output-drain
fix/legacy-swift-runtime-name-matching
fix/dylib-lazy-load-commands
fix/browser-scenario-startup-cancel
fix/swift-nested-punycode-classification
fix/compare-unselected-scopes
fix/objc-method-budget-coverage
fix/dmg-mounted-root-observations
audit/ci-tests-20261019-round2
release/6.7.0
fix/wabt-cleanup-retry-resolution
fix/electron-fuse-elf-pe-architecture
fix/native-plist-descriptor-ownership
fix/kuna-caller-cleanup-ownership
experiment/atomic-codemode-20261016
review/first-contributor-3776
fix/call-resolution-full-read-cycles
fix/member-mutation-selection-repeat
experiment/atomic-re-tools-20261015
perf/member-mutation-lazy-origins
perf/static-network-mutation-index
fix/hopper-startup-lifecycle
audit/3050-windows-proof-20261015
feat/windows-window-capture-2183
audit/3049-windows-proof-20261015
audit/3735-macos-fixtures-20261015
fix/batch-decompile-null-pseudocode
fix/kuna-inventory-honors-jobs
experiment/browser-codemode-tool-design-20261015
fix/hopper-clean-runtime-argv
codex/review-2049-27f1b367
review-fixes/pr-2787-routing
fix/3360-scoped-this-emitters
fix/3367-replaced-global-effects
fix/3838-compact-any-value-items
test/hopper-download-probe-20261015
codex/windows-runtime-creation-red-green-20261015
codex/windows-readonly-root-red-green-20261015
codex/windows-root-share-red-green-20261015
codex/exp-1685-win-mcp-startup
codex/bug-sweep-20261015
investigate/2190-windows-package-phases
investigate/3543-macos-cli-deadline
perf/3281-reverse-tools-feedback-quality
fix/3406-hopper-doctor-fixture
fix/3341-wrapper-require-test-context
fix/3301-owned-uninstall-fixtures
fix/3164-compiler-input-ownership
fix/pcap-cleanup-stdout-newline-20261014
perf/interface-builder-summary
codex/review-fixes-pr-1977
fix/ghidra-effective-jvm-platform
fix/docs-turkish-rust-link-20261013
fix/main-maintenance-ci-20261010
fix/recover-binary-session-process-effects
codex/review-fixes-pr-2457
codex/ci-required-cancellation-gate
fix/main-format-baseline-20261013
fix/setup-preserve-entry-fields
cursor/restore-main-checks-1ffc
fix/ghidra-bridge-hashmap-import
codex/shared-ci-jadx-json-default-20261013
codex/shared-ci-ghidra-test-groups-20261013
codex/shared-ci-java-fixture-format-20261013
codex/fix-intrinsic-invocation-boundaries
test/release-preflight-reusable-jobs
test/js-parameter-provenance-expectation
fix/linux-hopper-verification-current
test/2419-ghidra-elf-probe-size
followup/pr-1544-native-ida
codex/fold-pr-2230-contribution
docs/readme-responsible-use
fix/issue-2064
fix/issue-2050
fix/issue-2053
fix/issue-1968
fix/issue-1945
experiment/codemode-bridge-20261011
fix/tool-effects-negative-wording-1904-20261012
fix/1842-electron-interop-provenance
feat/recover-javascript-multi-input
refactor/website-i18n-prep
fix/nativeaot-pe-virtual-extent
fix/browser-verifier-ci-hang
fix/pe-resources-input-selection
docs/beginner-friendly-guides
docs/beginner-setup-guide
fix/javascript-analysis-worker-1563
fix/1649-ghidra-duplicate-names
fix/javascript-export-keys-integration-1369
test/maintenance-boundary-contracts-20261011
review/javascript-export-keys-1369
review/process-live-progress-1483
test/javascript-1495-growth-ratio
fix/ci-escape-timing
docs/normalized-terminal-geometry-1450
release/6.3.0
archive/release-6.3.0-pr1381
release/6.2.0
fix/electron-preload-dynamic-override
fix/javascript-self-referential-bundler-edges
release/6.1.0
cursor/grok-client-cherry-pick-0b56
feat/signature-posture
feat/dyld-shared-cache
feat/artifact-integrity-policy
feat/pkg-inventory
release/6.0.0
chore/sync-release-5.0.0
release/5.0.0
cursor/cloud-agent-node-787e
fix/javascript-xhr-open-endpoints
review/pr-711-realpath-fallback-wording
cleanup/replay-confinement
codex/test-suite-performance
codex/issue-foundations
codex/address-open-issues-2026-07-20
agent/javascript-vite-rollup-esbuild-adapters
agent/process-cleanup
agent/triage-integration
agent/unknown-commands-registry
feat/mcp-identity-metadata
morlvps/issue_cleanup
codex/installer-redesign
morl/roadmap-investigation-core
morl/roadmap-investigation-docs
release-please--branches--main--components--rea
rea-agents-6.8.0
rea-agents-6.7.0
rea-agents-6.6.0
experiment/atomic-codemode-wait-runtime-20261016
rea-agents-6.5.0
rea-agents-6.4.0
rea-agents-6.3.0
rea-agents-6.2.0
rea-agents-6.1.0
rea-agents-6.0.0
rea-agents-5.0.0
rea-agents-4.1.0
rea-agents-4.0.1
rea-agents-4.0.0
rea-agents-3.2.1
rea-agents-3.2.0
rea-agents-3.1.0
rea-agents-3.0.0
rea-agents-2.7.0
rea-agents-2.6.0
rea-agents-2.5.1
rea-agents-2.5.0
rea-agents-2.4.0
rea-agents-2.3.0
rea-agents-2.2.0
rea-agents-2.1.0
rea-agents-2.0.0
rea-agents-1.7.0
rea-agents-1.6.0
rea-agents-1.5.0
rea-agents-1.4.0
rea-agents-1.3.0
rea-agents-1.2.0
rea-agents-1.1.0
rea-agents-1.0.0
rea-agents-0.5.0
rea-agents-0.4.0
rea-agents-0.3.0
rea-0.2.1
rea-0.2.0
Labels
Clear labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
Mirrored from GitHub Pull Request
question
roadmap
triage
No labels
area: bridge
area: bridge
area: build
area: build
area: build
area: cli
area: domain
area: evidence
area: mcp
area: native
area: providers
area: runtime
area: server
area: setup
area: tests
bug
design
documentation
enhancement
enhancement
enhancement
experiment
help wanted
i18n
invalid
P0: critical
P1: high
P2: medium
P2: medium
P2: medium
P3: low
performance
provider-request
pull-request
question
roadmap
triage
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
morluto/rea#4258
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KJLavender on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/7038
Before submitting
Area
Evidence, artifacts, or reconstruction
Current limitation
React Native apps usually ship their JavaScript as Hermes bytecode (
assets/index.android.bundlein an APK, a.jsbundle/.hbcin iOS apps). Right now REA only recognizes React Native by native library names (libhermes.so,hermes.framework, seedocs/android-analysis.md). The bundle itself is opaque: no version, no strings, no function names.#3608 covers this as part of a much bigger React reconstruction RFC. This is a proposal for a small first slice that doesn't depend on any of the rest: read the Hermes container itself, without disassembly or decompilation.
Use cases
The first questions on a React Native app are usually "which servers does it talk to", "what are the API paths", "is there a hardcoded key", and "roughly how is the code organized". Almost all of that is in the Hermes string table and function table, which can be read statically.
As a check I ran a rough local reader on the public BlueWallet 8.0.2 APK (open source, Hermes bytecode v98, 14 MB bundle). The string table alone shows its Electrum servers (
electrum2.bluewallet.io:444,electrum.blockstream.info:60004), the price APIs it calls, and 26,262 named functions out of 40,594, including the Metro runtime (metroRequire,loadModuleImplementation, ...).Desired outcome and success criteria
For a Hermes bytecode file, either standalone or inside an APK/IPA inventory:
Non-goals for this slice: disassembly, decompilation, Metro module splitting, writing anything.
Expected interaction with targets
Read existing files or captured data
Target and scope details (optional)
Bytecode versions differ a lot (the small function header went from 16 to 12 bytes with a different bit layout around v97/v98, BigInt fields arrived in v87, etc.). I'd suggest starting with the versions current React Native ships (v96–v99) plus the older v83/v84 if it's cheap, and refusing others explicitly.
Verification available so far
I have a prototype or observed results
Verification details (optional)
Local prototype (~250 lines, Node only), compared field by field with hermes-dec 0.1.8 on Windows:
index.android.bundle(v98, 14 MB)The one difference on BlueWallet looks like a hermes-dec bug rather than mine: string #46390 is a single U+FEFF stored as UTF-16 (
ff fe), and hermes-dec decodes it with Python'sutf-16codec, which drops it as a BOM and returns an empty string.Every sample was compiled from my own JS with the official
hermes-compiler/hermes-enginenpm packages, so they can be regenerated and committed as fixtures.Alternatives considered
Possible direction
A Hermes reader in the artifact layer so
inspect_artifactcan classify the bundle and expose these facts (and APK/IPA inventories can point at it), following the same pattern as the PyInstaller reader. I'm happy to turn the prototype into a PR if this scope sounds right.References
BytecodeFileFormat.hfor the layouts@XinwangTao commented on GitHub (Oct 25, 2026):
这个切入点选得很好——把 #3608 里最独立的一块先落地,不依赖反汇编/反编译就能先覆盖取证时最常问的"连了哪些服务器、调了哪些 API、有没有硬编码 key"。你给的验证数据很有说服力(BlueWallet 上 40,594/40,594 函数、109,319/109,320 字符串与 hermes-dec 逐字段一致,0.16s 读完),BOM 那条差异也确实更像 hermes-dec 用 utf-16 codec 丢掉 U+FEFF 的问题,值得做成 fixture 用例固定下来。一个小问题:APK 里的 bundle 位于 assets/index.android.bundle,这个 slice 落地时是直接消费原始 bundle 文件,还是也需要处理 APK 内的定位/提取?另外建议在文档里明确版本矩阵(v96–v99 + v83/v84)和"不支持版本显式报错"的行为,避免误读。
@XinwangTao commented on GitHub (Oct 25, 2026):
Strong use case — Hermes bytecode is everywhere in modern React Native builds, and static reading of header/integrity/function/string tables would materially improve APK/iOS bundle triage without needing a JS engine. A few scoping thoughts: (1) start read-only (magic/version, source hash, function count, string table offsets) and keep any execution-related features out of the first slice; (2) the integrity field is worth surfacing even read-only since a mismatched hash immediately flags repackaging; (3) expose the bytecode version explicitly — Hermes versions drift across RN releases, and tooling needs to know which decoder applies.
@KJLavender commented on GitHub (Oct 25, 2026):
Thanks. On the APK question: I'd put the reader in the artifact layer, keyed on the Hermes magic rather than the filename, so it handles both cases the same way: a standalone
.hbc/.jsbundle, and theassets/index.android.bundlemember that the APK inventory already lists. No separate extract step, the member just gets classified and its facts attached. I'd check the APK path explicitly in the PR rather than assume it.Agree on documenting the version matrix and failing loudly outside it, that's the plan.
@jgt87 commented on GitHub (Oct 26, 2026):
Confirming on iOS, with a real-world v96 data point.
We hit this analyzing a shipping iOS app from the App Store: its React Native screens ship as Hermes bytecode v96 in
.hbcresources packaged inside the IPA (each as.../<bundle>.zip → index.ios.hbc), 19 bundles, the largest ~23 MB.open_binarycurrently rejects them:+1 on the slice as scoped — the header / string table / function table alone answer most of the first questions. Two small notes toward the version-range decision under "Target and scope details":
.hbc-inside-IPA case (vs. Androidindex.android.bundle) is real here, so classifying.hbcresources during IPA inventory would cover it.As an independent cross-check, we have a separate ~60-line Node v96 reader (string table incl. the overflow entries, small + large function headers, and the instruction stream driven by
BytecodeList.def) that we used to build a UI-element + design-token atlas from these bundles — happy to share regenerable v96 fixtures if useful for that row.@XinwangTao commented on GitHub (Oct 27, 2026):
Good real-world confirmation for iOS v96 — that also exposes a packaging wrinkle worth handling in the same slice: the bundles arrive as .../.zip members (index.ios.hbc inside), so besides keying on the Hermes magic, the artifact-layer reader should do member-level classification inside zip/IPA containers, just like the APK inventory already lists assets/index.android.bundle. That keeps the "no separate extract step" approach consistent across both platforms. Adding v96 to the documented version matrix would also cover the shipping iOS default.
@macjayz commented on GitHub (Oct 27, 2026):
I would like to contribute to this feature, but I see @KJLavender already has the core parser prototype and intends to prepare a PR. I do not want to duplicate that implementation. If a maintainer would like a parallel, bounded slice, I can take the APK/IPA ZIP-member classification and integration tests (including an iOS v96 fixture) after agreeing the artifact-layer contract. Please advise whether that division is useful.
@KJLavender commented on GitHub (Oct 27, 2026):
Thanks @jgt87, that's a useful data point. v96 wasn't in my test matrix, so I added it before replying.
The v96 compiler ships inside the
react-nativepackage: the hermesc bundled with RN 0.74 and 0.76 both reportHBC bytecode version: 96. I compiled the same samples with the RN 0.76 hermesc and compared the reader against hermes-dec. Header fields, every string and every function entry (name, params, size, offset) match. That includes the stress file, which forces overflowed ("large") function headers. It's now in the CI run alongside v83/v84/v98/v99: https://github.com/KJLavender/format-readers/blob/main/hermes/test/run.mjsOne thing I noticed: the v96 compiler rejects
classsyntax outright, so RN apps on v96 have all of that lowered by Babel first. Not a reader issue, just why the class/async sample only runs on v98+.Your v96 fixtures from a real app would still help, since compiler output from my samples is cleaner than a 23 MB production bundle. If you can share regenerable ones (or the source + RN version to rebuild them), I'll add them.
@macjayz the split sounds good to me: I take the reader (header, strings, function table, version matrix, failing loudly outside it), you take ZIP-member classification for APK/IPA, including the
<bundle>.zip → index.ios.hbcnesting, plus the integration tests. The reader would expose a single "is this Hermes, and what's in it" entry point keyed on the magic, so the container side only has to hand it member bytes. Happy to adjust if a maintainer prefers a different cut. Waiting on the scope call before either of us opens a PR.@macjayz commented on GitHub (Oct 27, 2026):
Thanks, @KJLavender. I confirm the split: I’ll handle artifact-layer ZIP-member classification and APK/IPA integration tests, including the nested
<bundle>.zip → index.ios.hbccase and a regenerable iOS v96 fixture where available. I’ll keep the slice read-only and pass member bytes to the reader entry point keyed on Hermes magic; I won’t duplicate parser logic. Please let me know a convenient time for the scope call, and I’ll then start the focused implementation.@XinwangTao commented on GitHub (Oct 28, 2026):
Agree with the split — reader (KJLavender) plus ZIP-member classification and integration tests (macjayz) is a clean cut, and holding both PRs until the maintainer scope call avoids churn. One small thing to pin in the shared contract: the reader entry point should return an explicit unsupported-version/unsupported-format signal (consistent with the "fail loudly outside the matrix" plan) so the classifier can surface it instead of silently skipping — that closes the gap where a member is classified as Hermes but the reader refuses it.
@macjayz commented on GitHub (Oct 28, 2026):
Small correction to my last comment: I misread "scope call" as a meeting. I understand it means the maintainer's scope decision, so I'm just waiting on that like @KJLavender, and won't open a PR before it.
Agree with @XinwangTao's point on the contract. For the container side, it would help if the reader's entry point returned three distinct outcomes:
That way an APK/IPA member that is recognised as Hermes but refused by the reader is reported as a limitation in the inventory instead of being silently dropped. The integration tests would cover all three, including the nested
<bundle>.zip → index.ios.hbccase.@morluto, whenever you have a moment, could you confirm whether this split and scope work for you?
@KJLavender commented on GitHub (Oct 28, 2026):
Agreed, those three outcomes work for me, with one addition from the reader side: a file can have the Hermes magic and a supported version and still be structurally broken (truncated, or a table that runs past the end). I'd report that as its own outcome rather than folding it into "unsupported", since "we don't read v100 yet" and "this file is damaged" mean different things to whoever reads the inventory:
The SHA-1 footer is a separate thing: a footer mismatch doesn't stop the read, so it'd be a fact attached to outcome 2 (the prototype already reports it that way), not a refusal.
The container side could fold 3 and 4 into one limitation if that's simpler there. I just want the reader to keep them apart.
@XinwangTao commented on GitHub (Oct 30, 2026):
这个四分类方案很清晰,我赞同把 malformed 单独拆出来——"版本还不支持"和"文件本身损坏"对 inventory 阅读者确实是两个完全不同的信号,前者是能力边界、后者是数据质量问题,合并会让 triage 时误判。补充一点:malformed 结果里建议带上具体失败位置(比如哪个 table 越界、偏移量),这样后续排查损坏原因时不用重新解析;SHA-1 footer 作为 fact 附加在 read 结果上的处理我也同意,footer 缺失/不匹配只标注不拒读,符合只读 reader 的定位。等 maintainer 的 scope 决定后就可以按这个契约落地。