Flutter reverse engineering: from APK to private API map.

A practical workflow for analyzing an Android Flutter application, understanding its network behavior, and turning an undocumented API into a tested standalone client.

Use this process only on applications and accounts you own or have permission to analyze. An undocumented API is not automatically an unauthorized API, but authorization, contracts, and permitted methods still matter. This article deliberately uses generic examples rather than details from a real target.

1. Define the authorized scope and the result

Start with the workflow, not the binary. Write down what the application does for the user and which part your team needs to reproduce. A useful objective is specific: read the current catalog, retrieve a document, or complete a defined account action.

Before analysis begins, record the application or test account you may inspect, the permitted techniques, the data you may store, and the expected deliverable. Decide whether you need an API map, a proof of concept, or a maintained client. That choice determines how much reverse engineering is justified.

A target contract should answer these questions:

  • Which user workflow is in scope?
  • Which requests or data are required, and which are incidental?
  • What authorization and test accounts are available?
  • Which actions are read-only, and which create side effects?
  • What rate limits, geographic constraints, and data-retention rules apply?
  • What result would let the client operate without the app?

Keep credentials, session cookies, personal data, and captured traffic out of general working notes. A sanitized request map is usually enough for the engineering team.

2. Preserve the APK and collect every package

Work on a copy and record a hash of every original package. This makes later findings reproducible when a device update changes the application underneath you.

shasum -a 256 base.apk > checksums.txt

Do not assume one APK contains the whole application. Android App Bundles often produce a base APK plus density, language, and ABI-specific splits. The base package may contain the manifest and DEX files while native libraries live in another package.

This matters for Flutter reverse engineering. If you inspect only the base APK and cannot find libapp.so, you may draw the wrong conclusion about the application. Collect the complete installed set, a universal APK, or at least the base and the ABI split that matches your test device.

unzip -l app-arm64.apk | grep -E 'lib(app|flutter)\.so'

lib/arm64-v8a/libapp.so
lib/arm64-v8a/libflutter.so

The paths above are an illustrative arm64 layout. Your filenames and split names will vary.

3. Identify where the application logic lives

Decode resources and decompile the Android layer before deciding where to spend time.

apktool d base.apk -o base-apktool
jadx -d base-jadx base.apk

Review the manifest for activities, services, permissions, network security configuration, and deep links. Then inspect the Java or Kotlin classes. In a Flutter application, these classes may be a thin shell around FlutterActivity and plugin channels rather than the main business logic.

libflutter.so

This is the Flutter engine. It contains the Dart VM runtime, rendering support, and native networking components. Flutter traffic can use BoringSSL here rather than the Java networking stack your Android proxy tooling expects.

libapp.so

This contains the application's AOT-compiled Dart code and snapshot data. It is where application classes, functions, constants, and much of the workflow logic can be found in an Android release build.

Check the ABI as well as the Flutter and Dart versions your tools support. A script built for one architecture or engine version may fail on another. The Blutter documentation, for example, currently describes support for Android libapp.so on arm64.

4. Establish traffic visibility before deep analysis

Traffic tells you which endpoints matter. Static analysis explains how those requests are constructed. Start with traffic because it can save days of unnecessary binary work.

Prove the proxy path first

  1. Use an owned test device and account.Install your proxy CA as appropriate for the test environment and confirm that an ordinary browser request appears in the proxy.
  2. Run one known read-only app workflow.Record the screen, action, and time so each request can later be tied to a user-visible result.
  3. Classify the failure.No connections suggests routing, caching, or an offline workflow. Failed TLS handshakes suggest certificate or trust problems. Connections that bypass the proxy may involve a different network stack or SDK.

If the browser works but the Flutter application does not, investigate Flutter's native TLS behavior. A Java-oriented certificate-pinning script may not affect verification inside libflutter.so.

Choose an interception method for the test environment

For an authorized test build, a debug configuration or a proxy-friendly build flag may be cleaner than modifying the application. When that is unavailable, the open-source NVISO Flutter TLS verification script is a common starting point for security researchers.

For a deeper diagnosis of proxy routing, certificate trust, and engine compatibility, see our Flutter SSL pinning and traffic interception guide.

frida -U -f com.example.app -l disable-flutter-tls.js --no-pause

The package name above is a placeholder. Check the script's current platform and architecture notes instead of copying offsets from an unrelated application. If it fails, verify the loaded library, ABI, engine version, and whether another plugin performs its own certificate checks.

TLS key logging is another option for some owned test environments. It can provide plaintext visibility without changing certificate verification, but the key log and decrypted capture are sensitive. Protect both, and never publish them.

The goal is not to defeat a control for its own sake. The goal is to observe an authorized workflow well enough to document its API contract.

5. Turn captured requests into an API contract

A packet capture is not yet an API map. Group requests by the action that caused them, then separate session setup, required workflow calls, analytics, and unrelated background traffic.

For each required request, record the method, path, query parameters, exact body bytes, relevant headers, cookies, response schema, and replay constraints. Note which values are constants, user input, server-issued state, timestamps, nonces, or signatures.

This illustrative map uses supplier.example. It shows the fields that matter, not a real service.

base_url: https://api.supplier.example
workflow: catalog-read
requests:
  - action: exchange an authorized test challenge
    method: POST
    path: /v1/auth/verify
    state: short-lived, single-use challenge
    replay: do not reuse a consumed challenge

  - action: read the catalog
    method: GET
    path: /v1/catalog?cursor=...
    state: authenticated session
    replay: allowed while the session is valid

  - action: renew the session
    method: POST
    path: /v1/session/refresh
    state: rotating refresh credential
    replay: serialize refreshes and persist the replacement credential

Follow pagination, filters, sorting, and response nesting. A request that returns the first page is not a complete API contract if the client needs every record.

Do not trust copied request bodies blindly

Request signing often depends on canonicalization. JSON whitespace, field order, path encoding, and line endings can change the signature even when two payloads look equivalent. Preserve the raw body until you know which representation the server expects.

6. Use static analysis to fill the gaps

Static analysis answers questions the capture cannot: how a signature is computed, where a session value originates, or why two requests with identical JSON produce different server responses.

Start with cheap evidence

strings lib/arm64-v8a/libapp.so | grep -E 'https?://|/v[0-9]+/'

Strings can reveal endpoints, error messages, class names, and useful constants. They do not reveal request logic on their own, and obfuscation or encryption can hide useful values. Treat a string as a lead, not proof.

Move to the right layer

  • Use JADX for Android activities, plugins, native SDK calls, and Java or Kotlin request builders.
  • Use a Flutter-aware tool for Dart AOT code. Blutter can reconstruct assemblies and object-pool data for supported targets.
  • Use native disassembly when the relevant operation sits in a shared library outside the Dart snapshot.
python3 blutter.py path/to/app/lib/arm64-v8a out_dir

Blutter documents asm/, pp.txt, objs.txt, and a Frida script template as outputs. The OWASP Flutter reverse-engineering guide explains why these artifacts are more useful than expecting ordinary Java decompilation to recover the Dart application.

Document signing as an algorithm, not a copied constant

When a request has a signature, identify the ordered inputs and transformations. Does it include the method, canonical path, query string, raw body, timestamp, device identifier, session token, or nonce? Which values does the server issue, and which are derived on the device?

Do not hardcode a recovered secret into your client or publish it. Some workflows use hardware-backed keys or server-issued credentials that should remain outside your source tree. In those cases, an authorized provisioning step or a hybrid client may be the correct design.

7. Reconstruct authentication and session behavior

A captured request proves that one session worked once. It does not prove that replay will work tomorrow. Model authentication as a state machine before writing the client.

anonymous
  -> challenge issued
  -> authenticated
  -> session expiring
  -> refresh succeeded
  -> authenticated

authenticated
  -> refresh rejected
  -> reauthentication required

Document the rules that affect automation:

  • Whether challenges and authorization codes are single-use.
  • How long access tokens, refresh credentials, and cookies remain valid.
  • Whether refreshing rotates the previous credential.
  • Whether sessions depend on device state, IP geography, headers, or request signatures.
  • Which responses require full reauthentication rather than another retry.
  • Where a human must complete MFA or another approval step.

Do not automate around MFA. Design for a human-approved authentication step, secure session persistence, and resumable work. Serialize refreshes so concurrent workers cannot rotate the same credential twice, and save replacement cookies or tokens returned by the server.

8. Build the smallest client that reproduces the workflow

Once the requests and session rules are understood, choose the simplest implementation. Use an HTTP client when the required calls can be reproduced directly. Use a browser or a hybrid approach when the workflow depends on JavaScript execution, interactive challenges, or browser-held state.

The following Node.js example uses a server-issued test token for supplier.example. It adds a timeout, checks status and content type, and validates part of the response schema. It contains no recovered credential or target-specific logic.

const BASE_URL = "https://api.supplier.example";
const token = process.env.SUPPLIER_TEST_TOKEN;

if (!token) {
  throw new Error("Set SUPPLIER_TEST_TOKEN for an authorized test account");
}

async function getJson(path) {
  const response = await fetch(`${BASE_URL}${path}`, {
    headers: {
      accept: "application/json",
      authorization: `Bearer ${token}`,
    },
    signal: AbortSignal.timeout(30_000),
  });

  if (!response.ok) {
    throw new Error(`Request failed with HTTP ${response.status}`);
  }

  if (!response.headers.get("content-type")?.includes("application/json")) {
    throw new Error("Expected a JSON response");
  }

  return response.json();
}

const catalog = await getJson("/v1/catalog");
if (!Array.isArray(catalog.items)) {
  throw new Error("Catalog schema changed: items is not an array");
}

console.log(`Received ${catalog.items.length} catalog items`);

For cookie-based workflows, use a cookie jar and secure storage rather than putting a session value in source code. Keep raw response fixtures with secrets and personal data removed so later changes can be tested without replaying production credentials.

9. Validate the client against the observed contract

Compare the client with the authorized application workflow. Status codes alone are not enough. Check response fields, pagination, session transitions, and whether the final state matches the app.

  • Valid session. Return the expected schema and required fields.
  • Expired session. Refresh once, persist the replacement, then retry only if the operation is safe to repeat.
  • Consumed or rotated credential. Stop and require reauthentication instead of starting a refresh storm.
  • Rate limit. Honor Retry-After and reduce concurrency.
  • Changed response schema. Fail validation and alert instead of silently returning incomplete data.
  • Uncertain side effect. Send the task for review rather than guessing whether it already completed.

Start with read-only validation. State-changing operations need explicit permission, idempotency rules, and a safe test environment.

10. Operate the integration responsibly

Production automation changes the risk profile. Store credentials in a secret manager, redact logs, limit account permissions, and restrict captured data to what the workflow needs. Keep a record of the authorization and permitted methods with the project.

Version the API contract and test it against sanitized fixtures. Monitor authentication failures, schema changes, challenge frequency, rate limits, and unexpected side effects. Stop on an unknown state rather than repeatedly trying new requests against a live service.

Flutter's --obfuscate option can rename symbols, but it does not encrypt resources or prevent reverse engineering. The Flutter obfuscation documentation makes that limitation explicit. Do not build a client security model on the assumption that compiled code or a hidden endpoint will stay secret.

Common dead ends

  • Inspecting only the base split. The Flutter libraries may be in the ABI package.
  • Starting with disassembly. A few captured requests may answer the question without deeper analysis.
  • Using a Java-only TLS hook. Flutter verification may happen in native BoringSSL code.
  • Treating strings as proof of request logic. They are clues that still need capture or control-flow evidence.
  • Replaying a captured session. Challenges may expire, rotate, or depend on device state.
  • Converting every workflow to HTTP. Some workflows still need a browser or a hybrid runtime.

What a useful deliverable looks like

A reverse-engineering engagement should leave more than a collection of captures. The useful result is an API map, an authentication state model, sanitized request and response examples, a tested client where feasible, and clear notes about limitations and operating rules.

Nina uses this process for mobile app and API reverse engineering. If your team owns a mobile workflow or has permission to analyze one, we can review the target and determine whether an API map, standalone client, or hybrid implementation makes sense.

Need a mobile app API mapped or rebuilt?

Tell us what you own or have permission to analyze, which workflow matters, and what you need to build. We will review the constraints and propose a technical scope.

Discuss a reverse-engineering project