SReverseby Simpa Labs

Binary protocols

Reverse engineering protobuf APIs on Android

Recover protobuf field numbers and wire types, then use the app's generated code and controlled examples to establish the message schema.

Decode the wire structure

A protobuf record starts with a varint tag: (field_number << 3) | wire_type. The low three bits give the wire type. The remaining bits give the field number. For example, 08 96 01 encodes field 1, wire type 0, with varint value 150. The protobuf encoding guide defines the layout.

Wire type 2 covers strings, bytes, nested messages and packed repeated values. Parsing a byte range as another message is a hypothesis to check, not proof that its declared type is a message. A numeric varint is not itself a field number; only the tag supplies that mapping.

Find the declared schema

Inspect generated classes, field-number constants, parser code and descriptors where present. Connect a field number with the caller that reads or writes it. Record which types are established by code and which still need testing.

Read the schema's field-presence rules. Proto3 implicit scalar presence differs from explicit optional or message-field presence, and editions have their own settings. An absent field does not establish one universal null or zero rule. See the proto3 language guide.

Test more than one encoding

Compare decoded values and application results across samples with changed inputs. Protobuf serialization is not canonical: field order and other valid encoding choices can differ while the decoded message stays the same. A byte-identical round trip does not prove the guessed schema, and different bytes do not automatically disprove it. The serialization guide describes that limit.

When a signature covers exact serialized bytes, test the app's encoder separately from semantic message equivalence. Keep unknown fields and verify how the selected runtime preserves them.

Check the surrounding transport

Locate the protobuf bytes inside the actual HTTP body, base64 wrapper, gRPC frame or socket message. Confirm content type and framing for successes and errors; the error body can use a different format.

A parser should check lengths and bounds and explain any bytes left over. Test truncated input and unknown fields with controlled fixtures before using it in the client.

Protobuf client reconstruction connects the schema and codec to login, signing and full workflows. Custom protocol work covers formats that do not follow protobuf.

A checked example with a multi-byte field tag

The owned fixture encodes field 20 as a length-delimited field containing packed unsigned integers 1 and 300. Its complete bytes are a2 01 03 01 ac 02. The tag takes two bytes; the packed value 300 takes two more. A parser that reads one tag byte or divides packed values into fixed widths misreads this example.

a2 01   field 20, wire type 2
03      payload length
01      first uint32: 1
ac 02   second uint32: 300

Those bytes also fit a bytes field. The wire format alone does not establish the declared field type or business name. Compare generated code and changed app inputs before choosing the schema. Protobuf’s encoding guide defines the wire types and packed fields. Java lite output also lacks the full reflection descriptors supplied by the full runtime, as the Java generated-code guide explains.

Download the test to check the exact encoding and decoded values. Keep that byte-level check beside request/response tests for the rebuilt client. A correct message parser still needs the app’s authentication, signing and request order to complete the buyer’s task.

Reviewed 22 October 2026 · SReverse research desk

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?