SReverseby Simpa Labs

Request reconstruction · signing

Why a captured Android request fails in Python

A copied request can fail because its signature, session or replay state no longer matches the server. Compare the exact bytes and response before changing headers. Then test each dependency with a known working request.

What the copy actually holds

A capture records the method, path, headers and body sent on one call. It does not explain how the app created those values or whether the server will accept them again. Record the response too: a captured request is not proof of a successful call.

Check timestamps, nonces, session tokens, device values and the signature covering them. Preserve the query encoding and body bytes. Two JSON objects can contain the same fields while producing different signatures.

Where the replay breaks

Compare the capture with a fresh successful app request. Check these dependencies against the implementation and response.

  • A signature over changing fields - the app signs the method, path, body, a timestamp and a nonce. The copy carries the signature for the moment you captured it; your replay has a fresh timestamp and body, so the signature no longer matches.
  • A value re-derived per call - a nonce or request ID can be checked against server replay state. Confirm whether the server requires a new value.
  • A date-bearing header - a signed timestamp can fall outside the server's accepted window. An ordinary Date header does not establish that rule.
  • Session or token state - the request is bound to a token that was valid then and has since changed, or that is device-scoped.

How to confirm which one it is

Start from a fresh working request and change one dependency per test. Recompute the signature whenever a signed input changes, while keeping the other inputs fixed. Reset the test session or nonce state between comparisons so an earlier test does not consume the next test's input.

A changed status narrows the investigation; it does not identify the cause by itself. Compare response details, generated bytes and the app's request builder. The owned fixture below has explicit error names so each result can be checked. Those names and its 30-second window are fixture rules, not claims about a real app.

Isolating the missing state
replay-check.py
# Download replay-check.py using the link below, then run:
python3 replay-check.py

# Expected output:
# timestamp: timestamp expired -> accepted
# nonce: nonce already used -> accepted
# body bytes: signature mismatch -> accepted
# repeat: accepted -> nonce already used

Download the Python replay fixture. It uses only the Python standard library, makes no network calls and checks every result with assertions. The timestamp and public key are fixed test values.

Reproducing the generation

Once you know which fields regenerate, find where the app computes them. The signing logic is usually in an interceptor (OkHttp, Retrofit), in a helper class, or in a native library. The nonce and timestamp generation is often right next to it. Read what the app signs, in what order, with what encoding, and rebuild that exact operation.

Fixture signing function
replay-check.py · excerpt
def sign(request):
    prefix = f"POST\n/catalog\n{request.timestamp}\n{request.nonce}\n".encode()
    signature = hmac.new(KEY, prefix + request.body, hashlib.sha256).hexdigest()
    return replace(request, signature=signature)

The fixture signs the exact body bytes after the method, path, timestamp and nonce. A real app can use different fields, separators, encoding and key sources. Recover those rules rather than applying this format to every API.

The sign of a real replay problem

Status / behaviorWhat it points toWhere to look
403 with a generic bodyThe server understood and refused the request. The status alone does not name the fault.Compare the response body, then re-sign and test before attributing it to signing.
401Missing or invalid authentication credentials.Check the challenge, response body and session flow; the status does not prove expiry or device binding.
409 or "duplicate"A conflict with current state; replay is one possible application rule.Confirm the error meaning before changing nonce generation.
Works in the app, 403 in PythonThe two executions differ in bytes, state or transport context.Compare the request and session before naming the blocked dependency.

Verify a fresh session

After rebuilding the request, test a fresh login or session, the next call and the refresh path. Record which app version and workflows passed. A matching HMAC proves one byte-level calculation; it does not prove the whole integration works.

For a second tested implementation, compare the Swift and TypeScript signing fixture. For an existing client that broke, use API integration repair.

Reviewed 17 October 2026 · SReverse

Related research

Relevant capability

When a replayed request fails, the deliverable is the working request layer, not a longer list of captured requests. Request signing

Start a project

Send the app you need to understand.

We rebuild the complete application flow and return the full API in Python, JavaScript/TypeScript, Postman and complete API documentation.

Projects start at $70. Most are delivered in 24 to 72 hours.

Start your full APK reconstruction

Send the full APK

Projects start at $70. Choose WhatsApp or email, then attach the APK in the app that opens. We reply within one hour with the next step and send the fixed quote after review.

Want us to contact you?