fix: gRPC detection can now connect to real (h2c) gRPC servers#77
Merged
GovindarajanL merged 1 commit intoJul 25, 2026
Merged
Conversation
GrpcEndpointDetectionTestCase probed for gRPC services over the shared
HttpClient, which wraps a standard OkHttp client. gRPC's wire protocol
is HTTP/2-only, and OkHttp never attempts HTTP/2 over a plain "http://"
URL by default (there's no ALPN negotiation without TLS) -- it silently
falls back to HTTP/1.1, which a gRPC server cannot understand at all.
The probe request fails at the transport layer before there's ever a
response to inspect.
Reproduced against gRPC Goat labs 001 (server reflection enabled) and
002 (plaintext gRPC), both confirmed live via docker logs: 0 findings on
both. Confirmed the transport-level cause by hand -- a plain HTTP/1.1
request never connects (curl: 000), while --http2-prior-knowledge
succeeds (curl: 415, real HTTP/2 response).
Adds HttpClient.postH2c(), which routes cleartext ("http://") targets
through a dedicated client configured for Protocol.H2_PRIOR_KNOWLEDGE.
"https://" targets are unaffected and continue through the standard
client, which already negotiates HTTP/2 via ALPN when supported.
Fixes OWASP#72
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #72
Summary
GrpcEndpointDetectionTestCaseprobed for gRPC services over the sharedHttpClient, which wraps a standard OkHttp client. gRPC's wire protocol is HTTP/2-only, and OkHttp never attempts HTTP/2 over a plainhttp://URL by default (there's no ALPN negotiation without TLS) — it silently falls back to HTTP/1.1, which a gRPC server cannot understand at all. The probe request fails at the transport layer before there's ever a response to inspect.Reproduction
Built and ran gRPC Goat labs 001 (server reflection enabled) and 002 (plaintext gRPC), both confirmed live via
docker logs. Scanning both produced 0 findings on both, including lab001 — the "reflection enabled" scenario this test case is specifically meant to catch.Confirmed the transport-level cause by hand:
Fix
Adds
HttpClient.postH2c(), which routes cleartext (http://) targets through a dedicated client configured forProtocol.H2_PRIOR_KNOWLEDGE.https://targets are unaffected and continue through the standard client, which already negotiates HTTP/2 via ALPN when the server supports it — no change to any other test case's behavior.Verification
postH2cinstead ofpostWithStatus; all still pass.Test plan
mvn testpasses