DruxAI
← New search
⚡ TechnologyBeta — synthesis improving

JNISleuth-MCP – Recover Stripped JNI Bindings and Ollvm Branches for Ghidra/Ida

3 modelsComplete
70%Consensus Score — 2 models mostly agreed, with some nuance. Read the breakdown.
🔴Semantic Entropy — Highly divergent · 2 distinct meanings across 2 responsesH=100%
70%
consensus
Mostly aligned
How much the models agreed on this answer

High agreement — the answer is well-supported across models.

Models agree on

  • ✓Use of RegisterNatives to recover stripped JNI bindings
  • ✓OLLVM control flow flattening involves a switch-case dispatcher and a state variable
  • ✓Triton and Angr are used for symbolic execution to resolve opaque predicates
  • ✓Frida is used for dynamic analysis of JNI calls
  • ✓Ghidra and IDA Pro are the primary platforms for this analysis

Points of disagreement

  • ~One model treats JNISleuth-MCP as a specific specialized tool/plugin to be analysed, while the other treats the prompt as a general request for a manual recovery methodology.

Recovering stripped JNI bindings and unflattening OLLVM-obfuscated branches is a complex process that transforms an unreadable 'ocean of unnamed functions' into a structured, analyzable codebase. Whether using a specialized tool like JNISleuth-MCP or a manual toolkit, the objective is to restore the mapping between Java and native code and resolve the distorted control flow graph (CFG).

1. Recovering Stripped JNI Bindings

In hardened Android binaries, symbols are often removed, and the mapping between Java and C++ is handled at runtime via RegisterNatives.

The Technical Process:

  • ·Static Analysis of RegisterNatives: The core goal is to locate calls to the RegisterNatives function. By tracing the JNINativeMethod array structure passed to this function, you can extract three critical pieces of data: the Java method name, the method signature (e.g., (Ljava/lang/String;)I), and the function pointer to the native implementation.
  • ·Pattern Recognition: Search for function signatures that match the JNI standard: void (*)(JNIEnv*, jobject, ...). In Ghidra, you can use Function Signature Analysis (Ctrl+Shift+A) to detect these patterns.
  • ·String Analysis: Even in stripped binaries, search for strings starting with Java_ (the standard naming convention) to identify potential entry points.
  • ·Dynamic Validation: If the app can be run, use Frida or Xposed to hook RegisterNatives at runtime, logging the exact mappings as they are registered by the Android Runtime (ART).

Result: Once these mappings are extracted, you can rename the obfuscated addresses in Ghidra or IDA, instantly grounding the business logic in its original Java context.

2. Unflattening OLLVM Branches

OLLVM (Obfuscator-LLVM) uses Control Flow Flattening (CFF) to condense logic into a single large switch statement inside a while(true) loop, governed by a "state variable."

Methods for Recovery:

  • ·Data Flow & Symbolic Execution: To resolve the "spaghetti code," you must analyze the state variable. Tools like Triton or Angr can be used to mathematically prove which state values lead to which execution paths, effectively ignoring "bogus" branches (opaque predicates) that are always true or false (e.g., if (x * x + 1 < 0)).
  • ·CFG Reconstruction: By tracking how the state variable is updated at the end of each basic block, the original logic can be reconstructed.
  • ·Patching and Microcode Modification: Once the true path is known, the binary can be patched. In IDA Pro, modifying the Hex-Rays microcode is more robust than patching raw assembly, as it replaces the switch dispatcher with direct jmp or conditional branch instructions.

3. Integration and Tooling

To be effective, these processes must be integrated directly into the disassembler's API:

Tool/ApproachPurposeIntegration
JNISleuth-MCPCombined JNI recovery & OLLVM unflatteningGhidraScript / IDAPython
Triton / AngrSolving opaque predicates/symbolic executionStandalone / Python API
FridaRuntime JNI binding interceptionDynamic Hooking
HexRaysDeobIDA-specific deobfuscationIDA Pro Plugin
Ghidra JNI HelperAuto-detection of JNI bindingsBuilt-in Ghidra Feature

Practical Workflow Summary

  1. ·Identify Bindings: Search for RegisterNatives and Java_ strings $\rightarrow$ Map Java methods to native addresses $\rightarrow$ Rename functions.
  2. ·Identify Obfuscation: Spot the "giant switch" in the decompiler $\rightarrow$ Identify the state variable.
  3. ·Deobfuscate: Use symbolic execution to solve predicates $\rightarrow$ Patch the dispatcher to restore linear control flow $\rightarrow$ Decode XOR-encoded strings.
  4. ·Analyze: Leverage the reconstructed pseudo-C code for vulnerability hunting or algorithmic analysis.

Follow-ups

You just saw open-source models answer

Want GPT-5, Claude, Gemini & more on the same question?

Sign in free to run any question against frontier models — side by side, same synthesis, honest comparison.

GPT-5Claude SonnetGemini 2.5 ProGrokDeepSeek R1Perplexity Sonar
Free models only · sign in for premium