Skip to content
RESEARCH INDEX BREACHROAD / INTELLIGENCE NOTE

gRPC and Protobuf penetration testing guide

A technical gRPC and Protobuf pentest methodology covering reflection, HTTP/2, mTLS, metadata, interceptors, schemas, streaming, limits and hardening.

PUBLIC RESEARCH
AUTHOR
/ CEO of Breachroad · OSCP · PNPT
PUBLISHED
7 April 2026
READING TIME
21 min read
TOPIC
Penetration Testing and AppSec
gRPC and Protobuf penetration testing guide

gRPC penetration testing evaluates HTTP/2 transport, TLS or mTLS, metadata, interceptors, services and RPC methods, Protobuf encoding, streaming and object-level authorisation together. The absence of a REST endpoint and a binary body unreadable in a browser are not security controls. Once an assessor has .proto files, a descriptor set or reflection access, the contract can be analysed as precisely as OpenAPI.

The short answer: effective gRPC testing begins with an inventory of services, methods and streaming types, then builds a matrix of roles, tenants, objects and fields. Every RPC must authenticate the connection and authorise the operation at the backend; mTLS identifies a technical client but not necessarily the end user. Protobuf tests must distinguish an absent field, a zero value, an unknown field and a oneof conflict. Streaming tests need limits, deadlines, cancellation and backpressure. Use synthetic records and agreed concurrency for every proof.

gRPC is widely used in microservices, cloud systems, mobile applications, telemetry and service-to-service communication. Teams often label it “internal” even when it is reachable through a load balancer, service mesh, VPN, partner connection or gRPC-Web gateway. Differences between internal, edge and transcoded REST policy are a recurring source of serious vulnerabilities.

The layers of a gRPC call

Conventional gRPC uses HTTP/2. A path identifies the service and RPC, HTTP/2 headers carry metadata, messages use length-prefixed framing, and trailers contain final status and supplementary information. The gRPC Metadata guide describes metadata as a key-value side channel used for credentials and tracing, among other purposes.

The technical model has six distinct levels:

LevelExample controlCommon failure
network and HTTP/2port, ALPN, routing, stream maximuman “internal” interface is publicly reachable
TLS/mTLSserver and client certificatesany certificate from an overly broad CA is trusted
metadatatoken, tenant, trace and deadlinecredentials travel in clear text or logs
interceptorauthentication, authorisation, rate limitinga separately registered method bypasses policy
Protobuftypes, presence, oneof and repeated valuesa default changes permission semantics
RPC logicobject, function and workflowBOLA, BFLA or process abuse

An API can expose unary, server-streaming, client-streaming and bidirectional-streaming calls. Each has different resource and authorisation concerns. A decision made only when a stream opens may be stale ten messages later or after a role changes.

Protobuf is not a security boundary

The Protocol Buffers Encoding Guide explains that the wire format carries field numbers while names and declared types come from the schema used for decoding. Serialisation order is not guaranteed. Parsers can retain or discard unknown fields depending on implementation and conversion path.

Security comes from semantics, not binary encoding. Important cases include:

  • field presence — omission may differ from explicitly sending zero or an empty string;
  • unknown fields — an older component can preserve a field it does not understand before a newer one uses it;
  • oneof — setting one member clears another, but order and translation can produce surprises;
  • repeated and map fields — element count and duplicate keys affect memory and logic;
  • enum values — an unknown numeric value can cross version boundaries;
  • numeric types — signed/unsigned conversion and language runtimes handle ranges differently;
  • well-known typesAny, Struct, Timestamp and wrappers introduce dynamic semantics;
  • schema evolution — reusing an old field number can give historical data a new meaning.

Reserve removed field numbers and names in .proto, and enforce business validation after deserialisation. The compiler checks type compatibility; it does not prove a number is positive, an object belongs to the tenant or a state transition is permitted.

Reflection, health checks and attack-surface discovery

gRPC Server Reflection lets a server publish its services and every type referenced by requests and responses. Tools can then operate without local .proto files. Reflection is extremely useful in development and for approved clients, but public exposure simplifies inventory.

Disabling reflection does not repair authorisation. Method names can be recovered from clients, logs, build artefacts, mobile packages, descriptor sets and gateways. Hiding the schema may slow analysis, but it is not access control.

The standard gRPC Health Checking Protocol provides unary Check and streaming Watch. Service names and status support operations but may expose internal topology when public. Reflection and health both need a deliberate exposure, authorisation and rate-limit policy.

Authentication with TLS, mTLS and call credentials

The official gRPC Authentication guide distinguishes channel credentials from call credentials. TLS authenticates the server and protects transport. mTLS adds client-certificate identity. An OAuth token or other credential can be attached to each call through metadata.

Key design questions include:

  1. Does the certificate identify a workload, organisation, device or individual user?
  2. How does a certificate SAN map to a principal and role?
  3. Can the trusted CA issue certificates to too many services?
  4. Does token verification enforce issuer, audience, time and scope?
  5. Do sensitive calls require both channel and call credentials?
  6. Can external metadata overwrite a trusted value set by the gateway?
  7. Could a retry, redirect or proxy forward credentials to another backend?

Interceptors centralise enforcement, but coverage must include every registered method, reflection, health and error path. One service added without the standard interceptor can bypass the entire model.

Scoping safe gRPC penetration testing

Scope should list hosts, ports, protocols, service meshes, gateways, environments, .proto files, descriptor sets, test certificates, roles and tenants. At least two accounts or principals in separate tenants plus each privileged identity are required.

Rules of engagement must set limits for:

  • concurrent channels and streams;
  • messages per stream and maximum message size;
  • deadlines and channel lifetime;
  • retry and cancellation tests;
  • methods that trigger costs, queues or external effects;
  • data the assessor may read or modify.

Do not run HTTP/2 exhaustion against production as part of an ordinary pentest. Verify enforcement at an agreed threshold instead. Use the wider REST, GraphQL and OAuth API testing methodology, extended for Protobuf and streaming.

Technical gRPC penetration testing methodology

1. Inventory endpoints and routing paths

Collect DNS, load balancers, ingress, service mesh, ports, ALPN, gRPC-Web and JSON transcoding configuration. Compare reflection with the .proto repository, gateway rules and clients. Record service, method, RPC type, owner, roles, data classification and business effect.

Look for old package versions, debug services, health, reflection and administration channels. A gateway may publish only selected REST methods while native gRPC remains reachable on the same load balancer.

2. Test transport and channel identity

Verify TLS, certificate names, trust chain, ALPN, protocol versions and rotation. With mTLS, test no certificate, an expired certificate, wrong SAN, another approved test client and revocation. Do not use keys outside scope.

Compare a direct route with service-mesh and gateway paths. A proxy must remove identity metadata that only it is authorised to set and never trust such fields from the Internet.

3. Build an authentication and metadata matrix

For every method, send controlled calls with no credential, expired credentials, wrong audience, insufficient scope and another tenant before using each valid role. Examine duplicate metadata keys, field-size boundaries and case handling in the relevant implementation.

Secrets must not appear in status messages, trailers, logs or traces. External correlation metadata should be distinct from an internal trusted value; a client must not impersonate the gateway.

4. Build a method, object and field matrix

Create a principal × method × object × tenant × field table. Repeat a valid account-A request while changing only the identifier to an account-B record. Then exercise privileged functions and mutable fields in create/update requests. The backend must enforce BOLA, BFLA and property-level authorisation.

Protobuf can hide mass assignment in fields a normal UI never sets. A request accepting a complete domain object may let a normal user attempt to change an administrator flag, owner or state. Use synthetic records and reversible changes only. These risks map to the OWASP API Security Top 10.

5. Perform schema-aware mutation

Instead of random bytes, modify messages intentionally from the descriptor. Test omission versus defaults, numeric boundaries, unknown enum values, additional fields, duplicate map keys, oneof, nesting and collection size. The goal is validation and version-disagreement analysis, not a parser crash.

Compare client→gateway, gateway→backend and storage→read paths. JSON transcoding can lose field presence, handle 64-bit numbers differently or discard unknown fields that native gRPC preserves. The same operation needs one security policy across transports.

6. Test streaming and changing context

For server streaming, verify that the client receives only authorised items and entitlement changes stop delivery. In client and bidirectional streams, authorise every message rather than only the initial open. Change tenant, object and operation type mid-stream with tester-owned data.

Assess ordering, replay, half-close, interruption and reconnection. After cancellation, the backend should stop costly work and release resources. The gRPC Deadlines guide notes that a deadline is not set by default, so a client may otherwise wait indefinitely. Services should choose suitable deadlines and propagate them downstream.

7. Verify limits and backpressure

In the agreed environment, verify limits for message and metadata size, concurrent streams per channel, messages per second, Protobuf collection size and slow-consumer buffers. Increase values gradually only to the agreed threshold. Expected behaviour is a controlled status, no partial business update and prompt memory release.

Rate limits should understand principal, tenant, method and cost. One RPC creating an expensive query or persistent stream is not equivalent to a lightweight health check. IP-only limits are weak behind proxies and for partner networks.

8. Review errors, status and trailers

Inspect gRPC codes, grpc-message, rich status details, debug data and trailers. Clients should not receive stack traces, SQL, internal hostnames, broker topics or complete objects in an error. A distinction between NOT_FOUND and PERMISSION_DENIED may disclose another tenant’s resource; choose behaviour according to the threat model.

After a transactional failure, confirm there is no partial write and retries are safe. Automatic retry of a non-idempotent method can duplicate a payment or order even when authorisation is correct.

gRPC detection and observability

Semantic logs should contain the complete service and method name, workload and end-user principals, tenant, authentication and authorisation outcomes, gRPC status, duration, deadline, input/output size, message count and stream lifetime. Do not log complete metadata or binary request bodies by default.

Useful alerts include:

  • public reflection or health use from an unapproved network;
  • sequences of UNAUTHENTICATED and PERMISSION_DENIED across methods;
  • one principal probing objects in many tenants;
  • rising messages, streams or calls without deadlines;
  • repeated cancellation while downstream work continues;
  • unknown enums, excessive unknown fields and deserialisation errors;
  • trusted identity metadata arriving from outside the gateway;
  • an obsolete method version used after its retirement date.

OpenTelemetry and service-mesh proxies provide transport metrics, while application interceptors know authorisation results and business cost. Correlate both perspectives.

Hardening gRPC and Protobuf

  1. Use TLS everywhere and mTLS for service-to-service traffic according to the identity model.
  2. Validate SANs and map a certificate to the smallest principal; do not trust only the issuing CA.
  3. Require call credentials where the service must know an end user or scope.
  4. Centralise authentication, authorisation, limits and logging in interceptors and test complete coverage.
  5. Authorise method, object, tenant and every mutable property at the backend.
  6. Validate Protobuf semantics after deserialisation; the compiler is not business validation.
  7. Reserve removed names and field numbers, and check schema compatibility in CI.
  8. Restrict reflection and health to intended consumers without treating obscurity as authorisation.
  9. Bound metadata, message, collection, stream and execution sizes.
  10. Apply deadlines, cancellation propagation, backpressure and cost-aware limits.
  11. Align policy across native gRPC, gRPC-Web and JSON transcoding.
  12. Filter trusted metadata at boundaries and keep secrets out of logs and errors.

Map controls to OWASP ASVS 5. Service-mesh policy, workload identity and private load balancers belong in an AWS, Azure and GCP cloud penetration test. If gRPC supports a web or mobile frontend, the full assessment remains part of web application penetration testing.

Pre-production gRPC checklist

  • Every host, service, method, version and streaming type has an owner.
  • Reflection and health have a deliberate exposure policy.
  • TLS/mTLS verifies names, trust, validity and revocation.
  • Trusted metadata is stripped at the edge and set only by the gateway.
  • Every method has principal, role, object, tenant and field tests.
  • Schema tests cover presence, defaults, oneof and unknown fields.
  • Native gRPC and transcoding enforce equivalent security.
  • Streaming reauthorises messages and responds to entitlement changes.
  • Deadlines and cancellation propagate downstream.
  • Limits cover size, rate, stream count and operation cost.
  • Logs exclude tokens, complete bodies and sensitive trailers.
  • Retesting covers gateway, mesh, backend and .proto compatibility.

Primary technical sources

Need to assess gRPC across a microservice estate? Combine .proto schemas, multiple role identities, gateway and service-mesh visibility, and controlled streaming tests. The report should identify the exact method, ineffective trust boundary and a remediation test suitable for automation.

SHARE / COPY