Before submitting
- I searched for existing feature requests (#13276, #13278).
- I read CONTRIBUTING.md so the request fits REA's local-only scope.
Area
Native / Decompiler Providers: Ghidra & IDA search_strings Scaling (bridge/ghidra/, src/ghidra/, src/ida/)
Current limitation
User report (Windows Unreal Engine game): calling search_strings({ "pattern": "warfare/storage/read-write" }) (default mode: "literal", case_sensitive: false) hung for 2+ hours with no response.
Alongside the IDA predicate-pushdown fix in PR #13291 (IdaProtocolValues.ts / IdaOperationRunner.ts), source analysis identified remaining architectural bottlenecks across Ghidra and IDA on large game binaries (millions of DefinedData / localized UI strings):
1. Ghidra literalCandidateMatcher floods every non-ASCII string across IPC (bridge/ghidra/ReaGhidraBridge.java:5601-5608, src/ghidra/GhidraProviderClient.ts:1184-1201)
- On default
case_sensitive: falseliteral search,GhidraClient.ts:499sendsliteral_ascii_candidate(lowercased ASCII). - In
ReaGhidraBridge.java:5604-5607:if (value.chars().anyMatch(character -> character > 127)) return true; - Any string containing any non-ASCII character (localized menus, CJK/Cyrillic/accented asset paths, copyright symbols, Unreal telemetry/editor text — often hundreds of thousands of strings in Unreal games) matches unconditionally as a false-positive candidate, gets serialized across the bridge socket, Zod-validated in
GhidraProviderClient, retained inrawResult(line 1195) /EvidenceLedger, and re-filtered in Node (filterGhidraLiteralCandidates).
2. Ghidra strings() eager per-string Gson heap amplification & comparator serialization (bridge/ghidra/ReaGhidraBridge.java:2732-2762, 5314-5325, 5881-5884, src/ghidra/GhidraJavaLaunch.ts:145)
- First invocation of
strings()walks every defined datum incurrentProgram.getListing().getDefinedData(true)(line 2737) and allocates a 3-field GsonJsonObject(encoding,termination,byte_length) per string under the default-Xmx2Gheadless JVM (GhidraJavaLaunch.ts:145). - Sorting via
INVENTORY_ORDER(line 5884) invokesGSON.toJson(item.facts)on comparator evaluations, andresultItem()(line 5319) callsitem.facts.deepCopy(). On multi-million-string Unreal binaries, this amplifies heap retention and triggers prolonged Stop-The-World GC thrashing under 2 GiB-Xmx.
3. Unbounded / slow pagination and missing operation deadlines on large string inventories
- Ghidra (
src/ghidra/GhidraClient.ts:477-515->GhidraClientWire.ts:123, 162):search_stringspassestimeoutMs: undefined, so a GC-thrashing or multi-million-item scan in Java never times out cleanly with actionable recovery. - IDA (
src/ida/IdaOperationRunner.ts:313-342,src/ida/IdaConfiguration.ts:29,src/ida/IdaHexRaysProtocol.ts:124):strings()hardcodeslimit: 100(line 329), resettingDEFAULT_IDA_REQUEST_TIMEOUT_MS(300 s) on each 100-item page without an operation-wide deadline or MCP progress ticks, whilerunHexRaysQuery(IdaHexRaysProtocol.ts:124) re-transmits the fullhexrays_queries.pysource per page request. This still affectslist_strings,mode: "regex", and non-ASCIIcase_sensitive: falsesearches (wherefind_regexenumerates unbounded candidates).
Use cases
- Searching literal asset/config/storage paths (
"warfare/storage/read-write") or symbols inside multi-hundred-MB Windows PE/PDB Unreal Engine games in Ghidra or IDA without multi-hour stalls. - Failing fast with explicit deadline & recovery guidance (such as
GHIDRA_HEADLESS_MAXMEM,search_bytes, or narrower patterns) rather than silently hanging.
Desired outcome and success criteria
Applying DDIA principles (exact character-folding pushdown, compact primitive storage views before serialization, and bounded operation deadlines):
- Exact Unicode simple-fold pushdown in
ReaGhidraBridge.literalCandidateMatcher:- Exhaustively checked against ECMAScript
/iuacross all 1,114,112 Unicode code points: onlyU+017F(ſ->s) andU+212A(K->k) fold into ASCII[a-z]under simple case folding. - Instead of
if (value.chars().anyMatch(c -> c > 127)) return true;, matchasciiPatternvia zero-allocation case/fold scanning (A-Z -> a-z,'\u017f' -> 's','\u212a' -> 'k') inside Java directly (preserving non-ASCII candidate passthrough only ifliteral_ascii_candidatewasnullfor non-ASCII patterns, or validating parity cleanly withGhidraLiteralSearch.ts).
- Exhaustively checked against ECMAScript
- Compact
StringFactsrecord inReaGhidraBridge.java:- Replace per-string eager
JsonObject facts+GSON.toJson(item.facts)comparator +deepCopy()with a lightweight primitive representation (String charset, boolean missingNull, int byteLength) that materializes JSON only for matched rows inresultItem().
- Replace per-string eager
- Bounded
search_strings/list_stringsdeadlines, progress reporting & larger IDA pages:- Bound full-inventory string searches cleanly with configurable timeouts / MCP progress notifications and support larger / configurable
find_regexpage sizes (and session-resident helper upload or larger batching inIdaHexRaysProtocol.ts/IdaOperationRunner.ts).
- Bound full-inventory string searches cleanly with configurable timeouts / MCP progress notifications and support larger / configurable
Expected interaction with targets
- Read existing files or captured data (local binary analysis under existing Ghidra/IDA session boundaries).
Target and scope details
- Covers
bridge/ghidra/ReaGhidraBridge.java,src/ghidra/GhidraClient.ts,src/ghidra/GhidraLiteralSearch.ts,src/ida/IdaOperationRunner.ts,src/ida/IdaHexRaysProtocol.ts. - Preserves ECMAScript Unicode simple case-folding semantics, deterministic
INVENTORY_ORDERsorting, and fail-closed timeout/cleanup behavior.
Verification available so far
- Source code analysis across Ghidra & IDA search pipelines.
- Exhaustive Node
v24.22.1check of all 1,114,112 Unicode code points confirming onlyU+017F(ſ) andU+212A(K) fold to ASCII under/iu. - Local
npm run verify:ghidra:bridge-sourcesrequiresGHIDRA_INSTALL_DIR(blocked in offline sandbox without Ghidra >=12.2 installation).
Verification details
Requires real-provider validation with:
npm run verify:ghidra:bridge-sourcesnpm run verify:ghidranpm run verify:ida- Plus bridge unit parity tests against
GhidraLiteralSearch.test.tsandIdaHexRaysProtocol.test.ts/test_hexrays_queries.py.
Alternatives considered
- Adding an LRU result cache in Node: does not fix the first cold scan (which is what hangs for 2+ hours on an Unreal game) nor reduce Java heap pressure / IPC flooding.
Possible direction
- Update
literalCandidateMatcherinReaGhidraBridge.java:5601-5608to foldA-Z,\u017f,\u212ainline againstasciiPatterninstead of returningtruefor allchar > 127. - Replace eager
JsonObjectper string inReaGhidraBridge.strings()(line 2749) with compact fields and skipGSON.toJsoninsideINVENTORY_ORDER. - Add explicit operation deadline & MCP progress ticks on
search_strings/list_stringsfor Ghidra and multi-page IDA scans.
References
- Related PR & issues: #13291, #13276, #13278
bridge/ghidra/ReaGhidraBridge.java:2584-2635, 2732-2762, 5314-5325, 5601-5608, 5881-5884src/ghidra/GhidraLiteralSearch.ts:15-76src/ghidra/GhidraJavaLaunch.ts:145src/ghidra/GhidraClient.ts:477-515src/ghidra/GhidraClientWire.ts:123, 162src/ida/IdaOperationRunner.ts:313-342src/ida/IdaHexRaysProtocol.ts:103-130
Activity
0No activity yet.