Skip to content

feat(ghidra): admit ARM PE targets on Windows - #3965

Merged
N0zoM1z0 merged 4 commits into
mainfrom
feat/windows-ghidra-arm-pe-2186
Oct 15, 2026
Merged

N0zoM1z0 merged 4 commits into
mainfrom
feat/windows-ghidra-arm-pe-2186

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fixes #2186. Builds on #2631, adding real Windows verification, ARMNT/Thumb fixtures, shared fixture coordinates, and a scoped analysis-profile discriminator.

Windows x64 Ghidra P0 now admits native ARMNT (Thumb-2) and ARM64 PE applications/DLLs through its existing read-only workflow. Previously, a real Microsoft Coreinfo ARM64 PE was rejected with Windows Ghidra P0 accepts x86 and x86-64 PE targets only.

Change and scope

  • Retain the original COFF machine at the PE parsing boundary and through file-backed target resolution. Windows ARM admission requires observed ARMNT 0x01C4 or ARM64 0xAA64; legacy ARM 0x01C0, Thumb 0x01C2, and missing machine facts fail closed.
  • Own the admitted PE architecture list at the Ghidra capability boundary. Preserve managed-image, role, NTFS, native-addon, source-identity, and process-ownership constraints, including the existing raw NMOS 6502 lane.
  • Let Ghidra's PE loader select ARMNT/Thumb or ARM64 language when no processor override is selected. Preserve explicit language/compiler choices and record their provenance as explicit-language-v1; retain the default profile identity. The source fixture verifier checks complete language IDs, not family prefixes. Commit the original machine to the Windows ARM PE profile and version only that lane; preserve other architecture/host cache identities.
  • Share encoded fixture layout and flag selection across source/packaged verifiers. Remove x64-only caller and byte-search address assumptions. Reject conflicting architecture flags without treating positional paths as flags.
  • Honor explicitly selected disabled analyzers in the source verifier and preserve completed primary facts if its separate file-offset lane fails. Reuse main's unified verifier timeout policy.

Contract and boundary impact

  • Semantic owner: existing Ghidra provider target admission and analysis-profile identity.
  • Contribution scope: maintainer-requested extension of an existing static, read-only provider (Proposal: admit bounded ARM / ARM64 PE targets on Windows Ghidra P0 #2186); no target execution, injection, mutation, protection recovery, or new provider authority. Additional execution-authority decision: not applicable.
  • CLI/MCP schemas and catalog: unchanged. Existing operations become available for admitted ARM PE targets.
  • Evidence and provenance: original target identity, source mappings, PE role, profile, and limitations retained. No new bulk response or eager inventory is added.
  • Cleanup: existing immutable snapshots, native handles, private runtimes, authenticated loopback, and Job Object ownership reused.
  • Generated/package metadata: no dependency, native ABI, installer, or generated-output change.

Expected effects:

  • Read existing files or captured data.
  • Launch an owned Ghidra/JVM process and run the existing bridge scripts.
  • Write owned ephemeral snapshots/projects/runtime files; never modify the selected input.
  • Use the existing authenticated IPv4 loopback transport; no remote target service.

Evidence and regression coverage

Executed on real Windows x64, Ghidra 12.1.4, JDK 21 and Node 24.18.0. All target analysis was static; neither application nor DLL/installer entrypoints were executed.

Target Observed result
Encoded ARM64 EXE All 26 read-only operations; return-42 decompilation; paged masked byte search; CLI/MCP file offsets, including ambiguous mappings; source unchanged; cleanup complete.
Encoded ARMNT/Thumb DLL All 26 operations; exported caller/callee and addition of one; return-42 decompilation; byte search; CLI/MCP file offsets; source unchanged; cleanup complete. Ambiguous mappings unavailable in its single-section layout.
Microsoft-signed Coreinfo64a.exe (498,480 bytes) Focused MCP entrypoint decompilation, identical repeated readback, loaded bytes matching source, unchanged input, same analysis run, cleanup complete.
Microsoft-signed VC++ 2013 ARM MSVCR120 DLL (715,760 bytes) Exported abs decompiles to absolute-value arithmetic; repeated readback, source-mapped bytes, unchanged input, same analysis run, cleanup complete.

Public inputs: Coreinfo, Microsoft VC++ 2013 redistributable. Installer contents were extracted as data without execution. SHA-256:

  • Coreinfo64a.exe: e7a3c5cd591d62815bbcbf97f1be7f8f58ff93e0bc069ff8d519d87d1e03e536
  • MSVCR120 ARM: 844870dfd6ddc13dfcc4d01fa54a2ea7ba8d26fc6695872683e5b67cc0c0ddfb

Real Windows admission regression after Codex review: the pre-fix public MCP accepted both legacy machines as arm; the rebuilt candidate rejects both, still admits both Microsoft public inputs, and records their exact machine values in their profiles. The four input hashes were unchanged and the runtime directory was empty after close. See review follow-up.

Performance and limits

Two logical CPUs, BelowNormal priority, 512 MiB Node/JVM heaps, explicit 900-second startup budget, and REA_GHIDRA_DISABLED_ANALYZERS=WindowsResourceReference were used. Product defaults are unchanged.

Public MCP query First query including cold analysis Identical same-session read Evidence text
Coreinfo ARM64 entrypoint 434.2 s 22.9 ms 4,622 bytes
MSVCR120 ARM abs 601.5 s 11.2 ms 4,789 bytes
COFF-bound MSVCR120 follow-up 407.4 s 15.3 ms 4,830 bytes

The COFF-bound follow-up selected an explicit 1,800-second startup budget after a preserved additional 900-second run returned provider_timeout; both attempts left the input unchanged and cleaned their runtimes. CPU, priority and heap bounds were unchanged. The successful query decompiled abs, matched source-mapped bytes, retained identical repeated readback and closed cleanly. A final-commit Windows MCP check revalidated all four admission cases and proved that its default MSVCR120 profile exactly equals the successful engine run's profile, including digest f45a85cbd9eb0f5a335424313b717bdc8c57379a1e16ca0a978fce902f64b98c.

These are individual observations on a constrained host, not a general speed guarantee or an attribution to a particular cache. Analysis sessions are reused for focused follow-ups. Failed attempts and input/runtime hashes were retained locally; transient deployment/download intermediates were removed.

Meaningful gaps: default-analyzer runs exceeded the startup budget; resource-reference analysis and default-configuration completion are unverified. No Windows-on-Arm host, ARM64EC/ARM64X, compiler-produced fixture matrix, x86-only compact-reference battery on ARM, or complete installed-package Ghidra verification is claimed. Explicit processor overrides are covered by catalog-backed profile tests, without real configured-processor analysis claims. Source fixture runs covered ARM64 EXE and ARM32 DLL; local header/admission tests cover all eight architecture/role combinations. The matching prebuilt native addon was reused from source 0f55f247c; the newer main volume-root write-sharing change was not in that binary. This feature changes no native code.

Validation performed

  • Final-head CI, attempt 2 — SUCCESS, including CI required, Windows capability/package and native build lanes. Initial Apple job failure was the unchanged .hop target-free MCP workflow hitting its 10-second test deadline; same-head failed-item rerun passed without code or timeout edits. That case took 5.583 s on retry; Apple regression results: 230 passed, 4 skipped across 18 passing files.
  • npm run build:cached — PASS.
  • Focused provider, Windows capability, fixture selector and verifier-timeout tests — 183 PASS, 1 macOS-only skip / 6 files.
  • npm run check:fast — PASS (typecheck/lint).
  • npm run docs:check — PASS, including 5 README consistency tests.
  • npm run verify:test-discovery — PASS, 1,299 files discovered exactly once.
  • Changed-file formatter check and staged whitespace check — PASS.
  • Real source verifier --arm64 and --arm --dll — exit 0; separate real public MCP probe — exit 0. Verification scope/configuration is stated above; raw host logs are kept private.

Author readiness

Human owner: @N0zoM1z0

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Concrete requested enhancement and focused Conventional Commit title.
  • Scope and authority preserved; related issue linked.
  • Changed behavior and failure paths covered; owning docs updated.
  • Representative real CLI/MCP results and meaningful gaps recorded.
  • Final diff checked for unrelated changes, private host/license data and unsupported claims.

Extend the existing read-only Windows P0 PE boundary to ARMNT/Thumb and ARM64 while preserving native admission and ownership controls. Share fixture coordinates across source and packaged verifiers, and isolate the Windows ARM cache profile.

Verified with real Windows x64 Ghidra 12.1.4/JDK 21: encoded ARM64 EXE and ARM32 DLL source lanes, plus focused MCP analysis of Microsoft Coreinfo ARM64 and Visual C++ 2013 ARM MSVCR120. Tests used two logical CPUs, 512 MiB heaps, a 900-second startup budget and explicitly disabled WindowsResourceReference. Default-analyzer completion and Windows-on-Arm hosts remain unverified. Local focused tests: 82 passed; check:fast, docs:check and test discovery passed.

Fixes #2186
@kaoru0822-kitauji
kaoru0822-kitauji marked this pull request as ready for review October 15, 2026 06:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T08:20:15.667900Z aeab4a1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no blocking issue was established.

Summary

Adds Windows Ghidra support for native ARMNT and ARM64 PE files while retaining the existing read-only workflow.

  • Windows Ghidra admits ARMNT and ARM64 PE targets.
  • Windows ARM PE profiles record how Ghidra imports the image.
  • Windows Ghidra fixtures and verifiers can target ARM and ARM64.

No actionable new issue was established in the changes since the previous review. No previous numbered findings were supplied. Live supersession status could not be checked because GitHub access was unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read PE header from selected file] --> B[Keep CPU family and original COFF machine]
  B --> C{Windows target checks}
  C -->|Unsupported machine, role, or managed image| D[Reject target]
  C -->|Admitted native PE| E[Commit analysis profile]
  E --> F{Explicit language selected?}
  F -->|Yes| G[Record explicit language and compiler]
  F -->|No| H[Let Ghidra select from PE header]
  G --> I[Use existing read-only Ghidra session]
  H --> I
Loading

Reviews (4) · Last reviewed commit: "fix(ghidra): preserve language selection..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8adc2c3e4d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ghidra/GhidraProvider.ts Resolved
Keep the encoded PE header and verifier coordinates under the same fixture owner. All eight regenerated fixture SHA-256 values are unchanged, preserving the real Windows verification inputs.
Preserve the original COFF machine at the PE parsing boundary and through file-backed target resolution. Admit Windows ARM only for observed ARMNT 0x01c4 or ARM64 0xaa64, preserve existing role and managed-image failures, and commit the machine fact to the scoped Windows ARM profile.

Real Windows MCP reproduced acceptance of legacy 0x01c0/0x01c2 before the fix and rejects both after it. Real Coreinfo ARM64 and VC++ ARMNT DLL admission remains available with exact machine facts; inputs are unchanged and runtimes cleaned. Focused checks: 181 passed, 1 platform skip across six files; check:fast and docs:check passed. Addresses Codex review comment 4280043857.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f60ecad6f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ghidra/GhidraAnalysisProfile.ts Resolved
@N0zoM1z0

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review current head 6f60eca, including the original-COFF-machine admission/profile follow-up. The prior finding was reproduced and fixed through real Windows public MCP calls; its thread links the before/after evidence. Local focused checks: 181 passed, 1 platform skip; typecheck/lint and docs checks pass. Latest-head CI and an additional real Ghidra ARMNT readback are running.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 6f60ecad6f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Distinguish explicit processor selections from the PE-loader-selected Windows ARM profile while preserving the default profile discriminator. Compare complete fixture language IDs and remove the superseded prefix representation.

Configured ARM and ARM64 profile regressions pass through language catalog admission. Retained real Ghidra reports match the exact expected ARM and AArch64 IDs with identical fixture hashes. Focused checks: 183 passed and 1 macOS-only skip; check:fast and docs:check passed. The COFF-bound real Windows MSVCR120 readback succeeded with an explicit 1800-second startup budget after a preserved 900-second timeout; all resource bounds and cleanup checks remain recorded.

Addresses review comments 4280331545 and 4280331554.
@N0zoM1z0

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review final head aeab4a1. All three prior findings are addressed: original COFF-machine admission, explicit-vs-loader language provenance, and exact fixture language IDs. Latest focused checks: 183 passed, 1 macOS-only skip; typecheck/lint and docs checks pass. Real Windows final-commit MCP revalidated all four admission cases and proved its default MSVCR120 profile equals the successful real Ghidra readback profile exactly. The PR now records both the preserved 900-second timeout and successful explicit-1800-second follow-up, resource/output measurements, and the unit-only scope for configured processors.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: aeab4a1677

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@N0zoM1z0
N0zoM1z0 merged commit 2b5ee72 into main Oct 15, 2026
73 of 77 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/windows-ghidra-arm-pe-2186 branch October 15, 2026 12:11
@morluto morluto added area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: ghidra Analysis provider / engine: ghidra labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request provider: ghidra Analysis provider / engine: ghidra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: admit bounded ARM / ARM64 PE targets on Windows Ghidra P0

2 participants