gRPC Server Reflection Enabled

The gRPC server exposes the reflection service, so anyone who can connect can list every service and method and download the message definitions needed to call them.

SeverityInformational
CVSS 3.10 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N Open in the calculator
CVSS 4.00 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere
OWASP Top 10A01:2025 Broken Access Control
MITRE ATT&CKT1595 Active Scanning
CategoryInformation Disclosure

Description

gRPC services are normally called from code generated from the service's Protocol Buffers definitions (.proto files), which describe each service, method and message. The optional server reflection service lets a client ask the server for these definitions at run time, through the grpc.reflection.v1alpha.ServerReflection service or its grpc.reflection.v1 successor. It is useful for development and debugging tools, but the server enables it in production, so anyone who can reach the gRPC endpoint can list every service and method it offers and obtain the full message definitions, a complete description of the API including its internal and administrative methods, without needing the client application or its definition files.

This removes much of the effort of discovering methods and building valid requests, and points an attacker directly to the internal and administrative methods worth testing. Reflection does not give access to any method by itself, as each method still enforces whatever authentication and authorisation the server applies, but its significance rises where the methods it reveals prove to lack those controls.

Reflection is turned on in code, for example with reflection.Register() in Go, ProtoReflectionService in Java, enable_server_reflection() in Python or MapGrpcReflectionService() in ASP.NET Core, often because it was copied from an example. The weakness is identified by connecting to the gRPC port with a tool such as grpcurl (using its list and describe commands) or grpcui, or with the gRPC support in Postman, and checking whether services and methods are listed without supplying any definition files.

Remediation

Register the reflection service only where it is needed:

  • Do not register reflection in production builds, or make its registration depend on the environment or on a configuration setting that is off by default, as in the example below.
  • Where operators need reflection in production, expose it only on an internal listener or network, or require authentication for it through a server interceptor or the platform's authorisation features.
  • Share the .proto files with legitimate clients through source control or documentation instead.
  • Treat this as hardening: enforce authentication and authorisation on every method, so that knowledge of the services gives no access.
// ASP.NET Core: map gRPC reflection only in development builder.Services.AddGrpcReflection(); var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.MapGrpcReflectionService(); }

Confirm the fix by running grpcurl's list command against the endpoint again and checking that reflection is no longer available.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More APIs Findings

Every APIs finding