跳到主要内容

REA 逆向分析工作流

收藏0

在授权前提下对原生二进制、JavaScript/Electron、APK、固件等做取证、反编译、版本比对与证据化分析的工作流手册;是 REA MCP 服务器的配套指令(需另装工具本体),仅限合法安全研究。

让 AI 安装

github最新版本 0.1.1更新于 2026-10-19下载 0 次2 个版本

references/javascript-applications.md

11.7 KB查看排版效果
1# JavaScript and Electron application artifacts
2
3For captured or bundled JavaScript that needs readable source recovery, use
4`recover_javascript_sources` with an absolute `path` and absent
5`output_directory`. Supply related runtime/shared/lazy files in
6`additional_paths` when advertised, then analyze the returned `analysis_input`
7directory together. Each input retains its own snapshot, digest and byte-range
8provenance; inputs and recovered code are never executed. Recovery requires a
9caller-supplied Wakaru on Linux x64; see [the recovery guide](https://github.com/morluto/rea/blob/main/docs/javascript-recovery.md).
10
11Use `analyze_javascript_application` directly on the operator-supplied ASAR or
12extracted tree. When the question concerns known source paths and the connected
13schema advertises `source_paths`, select exact inventoried paths such as
14`["package.json", "main.js", "preload.js"]`. Include supporting manifests or
15source maps explicitly; dependencies are not implicitly analyzed. REA retains
16the complete artifact inventory and identity but reads source text and analyzes
17only selected files. The result and summary record `source_selection`; files
18outside scope and their relationships remain unknown, so partial application
19coverage does not mean the selected source failed. Use repeated `--source-path`
20on either static application CLI route. Omit the selection when the question
21requires complete application analysis. `detail: "summary"` reduces delivery
22and does not by itself reduce analysis work.
23
24Exact `#alias` specifiers resolve through the importer's
25enclosing package `imports` map to package-local files; nested `node_modules`
26packages use their own map. Wildcard, recursive, and external-package import
27targets stay unresolved with that limitation. When size is unknown or large and the connected schema advertises
28`detail`, request `detail: "summary"`. This returns an `inspect_analysis_view`
29Evidence record with a distinct ID and a `normalized_result.parent_evidence_id`
30for the complete retained application analysis. Source-map contents are part of
31that static analysis. Read findings, coverage, limitations and unknowns, then
32follow a specific unanswered question. Older servers without `detail` return
33the complete application Evidence inline when it fits.
34
35When the connected schema advertises `max_heap_mb` and `analysis_timeout_ms`,
36these select the isolated source analyzer's old-space heap and per-source
37deadline. Defaults are 1024 MiB and 300000 ms. They do not change the MCP
38process heap. A Bun-hosted REA does not enforce the heap choice; on Windows it
39instead limits the analyzer's committed memory to that choice plus a 512 MiB
40runtime reserve.
41Resource-limited analyses preserve completed static facts and
42report partial semantic coverage with specific unknown scopes; this does not
43mean the source is malformed. Inspect those limits before retrying a source.
44When expanded relationships exceed the parent's available memory, inspect the
45file's modules item view for retained `static_analysis` and
46`semantic_module_analysis`. Their facts remain available even when graph links
47are unknown. Cumulative result exhaustion can stop analysis before every file
48is examined; the inventory and remaining unknown scopes distinguish that case.
49Timeout or cancellation after source analysis begins retains partial Evidence
50in the same session. A returned `error.details.partial_observation` reference
51can be supplied directly to `inspect_analysis_view`. If the SDK cancels locally, retrieve its recorded ID from
52the Evidence bundle before inspecting the partial analysis.
53
54## Read a module without repeating analysis
55
56Use the actual returned parent ID, on the same connection, as `source.evidence_id`.
57The following IDs are placeholders to replace with returned values. When the
58module's node ID is not already known, page identities before selecting an item.
59Pages return only node IDs, paths and roles; choose a useful page size and follow
60`coverage.next_offset` when another page matters:
61
62```json
63{
64 "source": {
65 "kind": "retained-evidence",
66 "evidence_id": "ev_ACTUAL_PARENT_ID"
67 },
68 "view": { "kind": "page", "collection": "modules", "offset": 0, "limit": 16 }
69}
70```
71
72Select the relevant page entry by its exact `node_id` and recorded role:
73
74```json
75{
76 "source": {
77 "kind": "retained-evidence",
78 "evidence_id": "ev_ACTUAL_PARENT_ID"
79 },
80 "view": {
81 "kind": "item",
82 "collection": "modules",
83 "selector": { "node_id": "jag_node_ACTUAL_NODE_ID" }
84 }
85}
86```
87
88Module pages include asset, bundled and source module roles, so one path can
89identify several entries. Use `selector.path` only when uniqueness is established;
90the returned node ID avoids needing a complete inventory to prove uniqueness. On ambiguity,
91select the matching node ID from the page or the error's candidates. Follow
92`next_offset` when another page matters. An item exposes that module node's
93recorded observations, identity, hashes, exports and source ranges; it does not
94include every child syntax observation, related edge or original source file.
95An absent item fact is not evidence of absence from the whole application.
96
97For canonical identities and retained source-range counts, use a typed reference
98page instead of reading every full item:
99
100```json
101{
102 "source": {
103 "kind": "retained-evidence",
104 "evidence_id": "ev_ACTUAL_PARENT_ID"
105 },
106 "view": {
107 "kind": "javascript",
108 "collection": "modules",
109 "projection": "references",
110 "where": { "path": "main.js", "kind": "javascript-module" },
111 "offset": 0,
112 "limit": 16
113 }
114}
115```
116
117Filters match exact retained strings; omit a filter to include all values, use
118`path: null` for unavailable paths, and `path: ""` for a recorded empty path.
119Rows preserve canonical `identity` and distinct observation support states in
120`basis`. `retained_source_range_count` counts retained source-range observations,
121not runtime imports or unique reference sites. Use a row's `node_id` with the item
122view above for exact locations and full supporting observations. Follow
123`coverage.next_offset`; page exhaustion describes matching retained rows only.
124Check `source_coverage` for source selection, partial/unknown graph coverage and
125unknown counts before drawing a negative conclusion.
126
127## Trace only the remaining question
128
129Use `trace_application_feature` on the parent application Evidence for one
130literal node ID, route, string, API, IPC channel, module, or native export.
131Select `incoming` for relationships leading to the seed, `outgoing` for those
132leaving it, and `both` when the question needs both. Trace traversal includes
133containment relationships, so even a narrow seed can expand many nodes; a
134bidirectional trace can reach unrelated sibling modules. A module item or page
135is preferable when its observations already answer the question. Do not treat
136all reached nodes as participants in the feature.
137
138Reuse retained parent Evidence when the server advertises it, or supply complete
139Evidence inline. Include Hopper or Ghidra Evidence only when its artifact digest
140matches exactly.
141
142## Recover an oversized display
143
144An oversized response reports `resource_constraint` and
145`details.resource: "transport"`. Reuse
146`details.reported_limits.evidence_reference` with `inspect_analysis_view` for a
147summary, one module, or a stable page of module identities.
148`export_evidence_bundle` writes the complete canonical session to a
149caller-selected file. These workflows keep the original Evidence and coverage;
150a broad follow-up can also exceed framing.
151
152A client can truncate a successful result inside its text envelope without a
153REA `resource_constraint`. Treat a truncation notice or incomplete JSON as a
154display limitation; do not claim the full record was examined. Reuse the known
155parent ID for smaller views, or export complete Evidence to a selected file
156while the session remains open. If the parent ID was lost from the preview,
157use the prior analysis summary or explicit ledger entries to recover it; do
158not invent an ID or rerun analysis just to reproduce the same display.
159
160BrowserWindow preferences, preload and contextBridge surfaces, IPC
161registrations, utility processes, and native binding requests are static syntax
162observations. Only a unique exact literal IPC channel match supports an inferred
163pairing. Dynamic or ambiguous channels remain unresolved. A requested `.node`
164member is not a verified native export. Never claim runtime reachability,
165registration, defaults, or policy enforcement from static analysis.
166
167For version comparison, analyze each version once, then call
168`compare_application_versions`. Accept only its digest, source-map, structural
169fingerprint, or non-module semantic matches. Module ordinals and minified names
170are not persistent identity. Report added or removed only with complete
171opposite-side coverage; otherwise report unknown.
172
173When the question asks how one exact exported callable's returned object shape
174changed, analyze each version once and then call
175`compare_javascript_export_shapes` with explicit module paths and export names.
176Use the returned IDs on the same connection, or complete inline Evidence
177records, from both analysis calls. Accept variant
178pairing only through the tool's unique exact literal discriminant. Read
179`property_inventories` and each change's `presence` before treating `unknown` as
180"the name was not observed": inventories list observed property names even when
181values stay unknown, with a `source_range` for each paired or unpaired variant.
182Array holes and mutation-invalidated slots are not observed properties.
183Complete parent coverage reports presence-only
184`added`/`removed` independently of unresolved values. Cite the
185comparison Evidence and report JSON Pointer changes; dynamic values, ambiguous
186variants, and incomplete parent-property coverage stay unknown. This is static
187inference, not runtime behavior. When runtime semantics are needed, run
188behavioral probes against the relevant application versions and capture them
189through the available browser, Electron, or process workflows.
190
191## Reusing application Evidence
192
193When advertised by the connected server, application trace and compare tools
194accept complete inline Evidence or
195`{"kind":"retained-evidence","evidence_id":"ev_<64 lowercase hex characters>"}`
196for their application input (`application`, or `left`/`right`). `inspect_analysis_view`
197uses the same retained-reference form in `source`, or portable inline Evidence,
198to project a summary, module page, or one module with its recorded observations.
199This notation is
200a template: replace it with the actual returned ID. Versions before 4.1.0 accept only full
201inline Evidence. Use the exact ID
202returned by the producer on the same MCP connection. Resolution does not run
203analysis or select a provider; findings remain inline. Native observation
204arrays still take full Evidence. `close_binary` clears retained references;
205export a bundle before closing, or supply portable inline Evidence in another
206connection. A missing reference includes its ID and recovery guidance.
207
208For exact file/native metadata or processing gaps, use
209`view: {kind: "javascript-facts", where: {paths: ["package.json"]}, property_keys: ["name", "operation", "analysis_status"], limit: 32}`.
210Rows retain canonical node/observation identity and original Evidence. Paths
211match Evidence artifact-path/source-range locations; missing properties remain
212omitted and source coverage stays separate from page exhaustion. Batch paths and
213select only needed property keys; complete Evidence remains accessible by export.
214If names are unknown, opt into `include_available_property_keys: true`; it lists
215the original keys per returned observation without unselected values. Keep each
216row's node/observation identity paired when composing facts.
217These rows select application-graph observations; semantic relationships and
218semantic unknown records remain in the complete parent Evidence and trace tools.

文件内容是平台检查时读出的文本,只供查看。平台不会运行包里的任何脚本或程序。