Introducing a new way to review your PRs.

Read the announcement

morluto / rea

Reverse engineer anything with agents, from app behavior down to native binaries.

View on GitHub

27 documents · Updated Nov 20, 2026

docs / application-reconstruction

Application reconstruction

Application reconstruction turns packaged application evidence into a cautious model of structure and behavior. It combines managed-code facts, mobile package inventories, JavaScript and Electron relationships, release comparisons, feature paths, and verification records while keeping observed facts separate from inference and unknowns.

Application graph projection

An application graph projection converts authenticated lower-level evidence into a graph for downstream analysis. It keeps artifact identity, relationships, source evidence, and coverage together so a missing observation is not treated as proof of absence.

Managed application graph

The managed graph joins PE/CLI artifact identity, assembly and module identity, types, methods, fields, native boundaries, calls, and field accesses into one application view. The graph service resolves the selected evidence records first, then authenticates and joins compatible source facts before it publishes an inferred, provider-neutral graph record linked to those sources. The graph describes static observations. It does not execute managed code or map a managed token to a native address.

Managed metadata tokens are build-local coordinates. Resolved type and signature facts provide safer comparison scope when available. Malformed metadata, partial member selection, incomplete method rows, unsupported target forms, and missing graph nodes remain coverage limits. Calls and field accesses keep separate edge counts, while omitted sites remain visible in the graph limitations.

References: src/…/ManagedApplicationGraphService.ts• L26-45 src/…/ManagedApplicationGraphService.ts• L63-113 src/…/managedApplicationGraph.ts• L47-109 src/…/managedApplicationGraph.ts• L175-253 src/…/managedApplicationGraph.ts• L266-452 src/…/managedArtifact.ts• L434-623

Mobile application projections

The Android, Apple, and HarmonyOS projections give an application-level view of package contents without decoding or running the target. They classify inventoried paths and hashes, infer possible runtime families, and record path-based bridge candidates between managed content and native libraries. Bridge candidates are leads for later analysis, not proof of a runtime call or native interface.

PlatformMain viewImportant boundary
AndroidAPK manifests, resources, DEX, JVM classes, native libraries, JavaScript, and signing entriesInventory does not establish manifest semantics, valid bytecode, or signing state
AppleIPA or macOS bundle roots, nested bundles, executables, frameworks, helpers, launchd files, JavaScript, and signing entriesPath roles do not establish plist, CMS, identifier, or loading semantics
HarmonyOSHAP, HSP, or App Pack layout, manifests, Ark bytecode, resources, native libraries, JavaScript, and child packagesPath presence does not decode Ark content, manifest meaning, or signing blocks

References: src/…/androidApplication.ts• L28-148 src/…/appleApplication.ts• L39-217 src/…/harmonyApplication.ts• L31-148

Reconstruction inputs

Reconstruction produces a structured account from an exact artifact or authenticated static observations. It records artifact identity and work limits so a reconstructed view cannot silently become a claim about execution.

JavaScript artifact reconstruction

JavaScript reconstruction reads an ASAR file or extracted directory, inventories relevant files, analyzes selected JavaScript sources, and builds application and semantic graphs. It also summarizes Electron processes and bridges. The work is execution-free. Resource limits, parse failures, invalid text, cancellation, and incomplete source selection remain visible.

The flow moves from exact local input to inventory, source analysis, graph construction, and sealed evidence. If work stops after source facts are owned, the result keeps a partial observation with its limits.

This diagram shows how local application input becomes an evidence-linked graph.

flowchart LR
    A[ASAR or application directory] --> B[Artifact inventory]
    B --> C[Selected JavaScript sources]
    C --> D[Bounded semantic projection]
    D --> E[Application and semantic graphs]
    E --> F[Electron boundary summary]
    F --> G[Evidence with coverage and limits]
    C -. interruption after facts are owned .-> G

Electron coverage uses separate states for no retained Electron reference, a referenced module with no recovered boundary fact, recovered boundary facts, and partial coverage. A zero count in the empty state is a coverage result rather than proof that the application has no windows or IPC. Partial coverage also keeps facts from syntax recovery or resource-limited analysis while marking unexamined Electron-loading sources as unknown. Type-only imports, resolve-only lookups, local bundle modules, and conditional loader findings do not become proven Electron coverage.

References: src/…/JavaScriptArtifactReconstruction.ts• L55-81 src/…/JavaScriptArtifactReconstruction.ts• L83-174 src/…/JavaScriptArtifactReconstruction.ts• L175-415 src/…/JavaScriptArtifactReconstruction.ts• L419-537 src/…/JavaScriptArtifactGraphElectronCoverage.test.ts• L133-202 src/…/JavaScriptArtifactGraphElectronCoverage.test.ts• L204-425

Managed reconstruction import

Managed reconstruction import attaches decompiler text to methods already observed in authenticated static managed-member evidence. Each method must match the exact artifact, method token, signature digest, and normalized IL digest. C# or pseudocode is analyst inference. Metadata and IL observations remain the canonical static facts.

The import validates the request, authenticates the member evidence once, checks each method lock and text digest, and publishes an inferred evidence result linked to the authenticated static source. It records decompiler identity, options, text digest, and source location when available. It does not execute, load, reflect over, debug, patch, or decompile the target artifact.

References: src/…/ManagedReconstructionService.ts• L20-62 src/…/ManagedReconstructionService.ts• L79-119 src/…/managedReconstruction.ts• L22-120 src/…/managedReconstruction.ts• L141-240 src/…/managedReconstruction.ts• L266-335

Member comparison

Member comparison explains how two managed member inventories differ without treating build-local metadata tokens as persistent identity. It reports unchanged, changed, added, removed, and unknown members with the evidence used to pair each side.

Managed member matching

The comparison workflow supports two authenticated managed-member evidence records or two local PE artifact paths. It authenticates both sides and rejects a self-comparison before it publishes the inferred comparison. For paths, it resolves and verifies both artifacts, applies the same optional type scope to each side, and creates static evidence before it compares the observations. A failure while reading the second path retains the first inspection as partial evidence.

The workflow emits an explicit unknown question when unmatched or ambiguous members remain. This keeps unresolved comparison work visible to the next investigation step instead of presenting a partial result as complete.

The workflow uses bounded artifact and metadata reads. It does not decode user-string literals because member comparison does not need them. The final comparison is inferred evidence that links both source records and keeps the selected scope and read limits with the result.

The comparison uses unique exact evidence first. It then uses declared type, signature, or structural evidence suited to the member shape. It never uses a name alone and does not force a pair when several members could match. Resolved signatures prefer namespace-qualified type names and enclosing names.

When resolved signature identities are not available on both sides, raw signatures preserve possible pairs without proving that referenced types have the same identity. Declaring-type scope, selected types, and complete MethodDef row coverage control whether an unmatched member can be called added or removed. A field Constant-table value is file-backed metadata. It is not a runtime field value and is not a comparison dimension.

For paired methods, the result can compare metadata, signatures, CIL, opcode shape, call and field shapes, target identities, exception shape, and body availability. Missing site alignment or unresolved targets produce unknown results. Decoded string literals are not compared.

ResultMeaning
unchangedPaired metadata and available body dimensions agree
changedA paired member differs in a compared dimension
added or removedOne side has a member and the other fully covers the relevant scope
unknownCoverage, decoding, or identity ambiguity prevents a safe conclusion

References: src/…/ManagedMemberComparisonService.ts• L23-90 src/…/ManagedMemberComparisonService.ts• L93-167 src/…/managedMemberComparison.ts• L65-225 src/…/managedMemberComparisonCoverage.ts• L38-144 src/…/managedMemberComparisonCoverage.ts• L183-265 src/…/managedArtifact.ts• L100-179 src/…/managedFieldConstant.ts• L3-44

Managed-native boundary verification

Managed-native verification checks declared P/Invoke imports against native export and function evidence supplied by the caller. It accepts supported observations as a separate evidence set and keeps unsupported observations visible in coverage. Native subject format controls module identity and platform authority: Mach-O ABI prefixes are removed only for symbol comparison, while Windows decorated-name candidates are not accepted for known Mach-O or ELF observations. A format-unknown observation can remain unresolved when module identity is not proved.

A native name match shows that a candidate symbol was observed. It does not prove CLR binding, marshaling, call reachability, runtime loading, or a managed-to-native body map. Native-body implementations without an explicit bridge remain unresolved.

StatusMeaning
verifiedExact import name and compatible module evidence were observed
inferredA decorated name candidate matched the declared module within the allowed platform authority
unresolvedNo candidate was found, evidence was unsupported, or module identity was unavailable
contradictedA candidate exists but its module conflicts with the declared import scope

References: src/…/ManagedNativeVerificationService.ts• L23-86 src/…/managedNativeVerificationSource.ts• L28-47 src/…/managedNativeVerificationSource.ts• L57-125 src/…/managedNativeVerificationSchemas.ts• L53-94 src/…/ManagedNativeVerificationService.platform.test.ts• L122-201

Feature tracing

Feature tracing follows a literal seed through the reachable part of an authenticated JavaScript Application Graph. It returns seed matches, graph paths, terminal entities, authority counts, and any handoff to native evidence without opening a provider or running the application.

Cross-layer feature trace

The seed can identify a node, route, string, channel, module, API, or native export. The trace can follow outgoing, incoming, or both directions. A native handoff links the path to available native observations or recommends later binary analysis. It does not prove execution. No seed match means only that the literal was not found in the supplied graph.

This diagram shows how a literal seed becomes an evidence-linked path.

flowchart LR
    A[Literal feature seed] --> B[Seed matches]
    B --> C[Reachable graph path]
    C --> D[Terminal application entities]
    C --> E[Native handoff]
    D --> F[Evidence-linked trace]
    E --> F

References: src/…/javascriptFeatureTraceSchemas.ts• L52-79 src/…/javascriptFeatureTrace.ts• L39-137 src/…/javascriptFeatureTrace.ts• L223-268

Reconstruction obligations

Reconstruction obligations turn application findings into claims that a replacement or reconstruction must satisfy. They connect each claim to original evidence, an owner, required cases, dependencies, verifier authority, and remaining unknowns.

Obligation ledger

The ledger derives conservative candidates from application graphs, semantic graphs, and process captures. A candidate is not proof of runtime behavior. The service validates the request, evaluates the ledger, and publishes it as inferred analyst evidence.

One clear owner, required cases, a suitable verifier, complete dependencies, and no open contradiction or unknown are needed for closure. Duplicate evidence IDs, non-canonical bundles, and review records that cite missing evidence are caller errors.

Ledger stateMeaning
unownedNo single reconstruction owner is bound
implementedAn owner exists but proof conditions remain
verifiedOwner, cases, authority, verifier, and dependencies are complete
blocked, contradicted, or unknownA concrete reason prevents closure
out-of-scopeThe claim remains visible but is outside the selected goal

References: src/…/ReconstructionObligationCandidates.ts• L39-69 src/…/ReconstructionObligationCandidates.ts• L72-263 src/…/ReconstructionObligationLedgerEvaluation.ts• L53-113 src/…/ReconstructionObligationLedgerEvaluation.ts• L173-359 src/…/reconstructionObligationLedgerSchemas.ts• L44-92

Coverage evidence

Coverage evidence decides whether a named reconstruction boundary has enough trustworthy proof to be ready. It checks required surfaces, owners, finite claims, verifier contracts and results, package proofs, contradictions, and residual unknowns as one fail-closed decision.

Boundary closure

Each boundary defines the surfaces, claims, package proof kinds, and allowed exceptions for the decision. Verifier results must match the current artifact and owner digests, contract, dimensions, authority, normalization, repeat count, and age. Partial, stale, failed, skipped, truncated, or conflicting proof does not become a pass.

Evidence cited by a verifier or package proof must meet the required authority and confidence. Static package claims can use suitable derived shipped-artifact evidence. Runtime package claims require observed evidence. The result is ready only when no reason remains. Otherwise it is partial, unknown, or failed with stable reasons and next probes.

References: src/…/reconstructionCoverage.ts• L49-186 src/…/reconstructionCoverage.ts• L232-306 src/…/reconstructionCoverage.ts• L381-415 src/…/reconstructionCoverageEvidence.ts• L7-64 src/…/reconstructionCoverageEvaluation.ts• L47-148 src/…/reconstructionCoverageEvaluation.ts• L256-381

Analysis boundaries

These workflows preserve the difference between structure, inference, and behavior. Graphs and traces describe supplied evidence. They do not by themselves prove execution, reachability in every state, native ABI correctness, or equivalence of two releases. For binary export or function-level diagnostics, continue to Binary diagnostics and comparison.

The broader system context is in Artifact and application analysis. JavaScript and desktop reconstruction is described in JavaScript and desktop reconstruction. Firmware and embedded work is described in Firmware and embedded analysis. Desktop runtime context is described in Desktop application environments.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep graph joins tied to one artifact digest and compatible module identity scopes. Treat tokens as build-local coordinates.
  • Keep graph source links aligned with every selected managed evidence record so downstream users can trace the projection.
  • Keep call and field-access aggregation aligned with decoded instruction facts and reported omission limits.
  • Keep partial metadata, selected types, and method-row scope visible so missing members do not become absent members.
  • Keep field Constant-table declarations separate from runtime field observations and preserve unavailable defaults as limits.
  • Keep mobile bridge candidates tied to inventory completeness.
  • Keep imported decompiler text marked as inference and locked to exact static method evidence.
  • Keep signature identity, nested type identity, selection scope, and raw-signature fallback aligned so members do not become false additions or removals.
  • Keep unresolved comparison members connected to an explicit workflow unknown rather than a complete result.
  • Keep path-based comparison inputs on the same type scope and preserve artifact identity checks and read limits on both sides.
  • Keep instruction-site facts aligned with call and field target comparison. Missing or duplicated sites remain unknown.
  • Keep native symbol normalization limited to comparison. Preserve source evidence, subject format, module identity, and platform authority.
  • Keep native source IDs unique. Keep accepted, unsupported, symbol, status, and unresolved-body counts consistent.
  • Keep retained native export evidence compatible when newer optional fields are absent.
  • Keep feature-trace handoffs linked to exact native evidence and preserve the no-execution boundary.
  • Keep Electron coverage states tied to retained module identity and analysis limits. Do not turn empty or partial counts into proof of absence.
  • Keep obligation input errors distinct from protocol failures and publish the complete ledger as analyst inference.
  • Keep semantic limits, verifier authority, package-proof authority, contradictions, and residual unknowns aligned with closure status.

Important failure modes

TriggerConsequenceGuard
Managed graph inputs report different artifact or module identitiesObservations cannot be safely joinedReject the projection
Selected graph sources are not retained as evidence linksDownstream analysis cannot trace the inferred graph to its inputsLink each selected source record
Metadata or member input is partial, malformed, or pagedAbsence and relations cannot support complete conclusionsPreserve coverage limits and do not treat missing rows as absent
A relation points to an unsupported target or missing nodeThe relation is omitted from the graphCount the omission and expose its limitation
A reconstruction lock or text hash does not matchText is not attached to the observed methodReject the import
Comparison inputs use the same evidence recordA self-comparison is not a valid two-side comparisonRequire distinct authenticated source IDs
A local path cannot be resolved, opened, or verifiedThe comparison fails before it can produce trusted evidenceKeep the path-specific failure and require artifact identity checks
The second local inspection fails after the first side is readThe comparison fails, but the first observation may be retained as partial evidencePreserve the retained partial evidence
Comparison selections differ or method rows are incompleteAdded or removed status may be falseReturn unknown and retain the scope limitation
A field default is unavailable or undecodedIt cannot support a field comparison conclusionKeep it as metadata coverage only
A native candidate conflicts with the declared moduleThe boundary is contradictedCompare normalized module identities
A decorated-name candidate comes from a known non-Windows subject formatA platform-incompatible candidate could be accepted as an inferred matchUse the authenticated native subject format as platform authority
Native source IDs repeat or an operation is unsupportedInput is rejected or coverage stays partialRequire unique IDs and count unsupported observations
A retained native export lacks an optional newer fieldA valid observation cannot enter verificationAccept the supported export payload without that field
A feature seed has no match in an incomplete graphThe trace may hide an omitted featureReturn no-match with coverage limits
An Electron reference has no recovered boundary factZero windows or IPC operations can be mistaken for absenceReport empty coverage and retain the limitation
An Electron source is syntax-recovered, unresolved, interrupted, or budget-limitedWindows, preloads, bridges, and IPC operations from that source remain unknownReport partial coverage and narrow source selection when needed
A conditional or local bundle loader is mistaken for an external Electron loadBoundary counts become falseRequire a proven external loader identity
A verifier or package proof lacks required authority or is staleClosure remains unknown or failedRequire current proof that matches the boundary contract
A required surface has an active contradictionThe boundary cannot closeReturn failed closure

Key files

FileWhy to read it
src/…/ManagedApplicationGraphService.tsManaged graph input resolution, source authentication, source links, and evidence publication
src/…/managedApplicationGraph.tsManaged graph identity checks, joins, relations, and coverage
src/…/managedArtifact.tsPE/CLI, metadata, member, body, field-default, and native-boundary evidence contract
src/…/ManagedReconstructionService.tsExact static locks for imported managed reconstruction
src/…/managedReconstruction.tsManaged reconstruction import contract and inference limits
src/…/ManagedMemberComparisonService.tsAuthenticated evidence comparison, path-based comparison selection, and residual unknowns
src/…/managedMemberComparison.tsMember pairing and comparison result states
src/…/managedMemberComparisonCoverage.tsScope agreement and complete versus partial comparison
src/…/managedNativeVerificationSource.tsManaged-boundary and native-observation admission, platform identity, and source coverage
src/…/managedNativeVerificationSchemas.tsNative verification states and count contracts
src/…/ManagedNativeVerificationService.platform.test.tsCross-platform module aliases and decorated-name authority guarantees
src/…/JavaScriptArtifactReconstruction.tsJavaScript and Electron reconstruction flow
src/…/JavaScriptArtifactGraphElectronCoverage.test.tsElectron coverage states, loader identity, partial analysis, and syntax-recovery guarantees
src/…/javascriptFeatureTrace.tsGraph traversal, terminal paths, and native handoffs
src/…/ReconstructionObligationCandidates.tsObligation discovery from application and process evidence
src/…/ReconstructionObligationLedgerEvaluation.tsOwnership, authority, verifier, and dependency closure
src/…/reconstructionCoverage.tsBoundary model and closure status
src/…/reconstructionCoverageEvidence.tsAuthority and confidence rules for proof evidence
src/…/reconstructionCoverageEvaluation.tsFail-closed coverage checks and next probes