Summary
grpc-gateway v2.28.0 may trust an attacker-controlled HTTP method override when processing certain form-encoded POST requests. This can cause routing to use an unintended method and bypass method-based authorization controls enforced by upstream proxies or web application firewalls.
Affected context
The vulnerability occurs in deployments using grpc-gateway's ServeMux.ServeHTTP while accepting method overrides through the X-HTTP-Method-Override header. Risk is higher when authorization decisions are made by upstream proxies, WAFs, gateways, or routing layers that rely on the original HTTP method and do not consistently enforce the rewritten method.
Exploit preconditions
- Attack surface: HTTP endpoints handled by grpc-gateway's
ServeMux - Required access: Ability to send requests to an exposed gateway endpoint; valid application credentials may or may not be required by the surrounding deployment
- Trigger point: Processing of a form-encoded POST request containing an attacker-controlled method override header
- Why exploitation is possible: The request method may be rewritten to an arbitrary value before routing, creating inconsistent authorization decisions between upstream controls and the gateway
Why this happens
The underlying bug is insufficient validation and authorization of a client-controlled method override. The gateway accepts an attacker-supplied method value and applies it before routing without restricting it to an approved set or ensuring that upstream and downstream security decisions use the same method.
This behavior maps to CWE-639: Authorization Bypass Through User-Controlled Key, because attacker-controlled request metadata influences the resource or operation selected by authorization logic. More broadly, it represents inconsistent access-control enforcement across HTTP processing layers.
Potential impact
- Unauthorized access to operations protected by method-based controls
- Bypass of proxy or WAF rules that distinguish requests by HTTP method
- Exposure, modification, or deletion of data when route authorization is inconsistent
- Increased risk of privilege misuse or unauthorized state changes
- Potential compromise of downstream services reachable through the gateway
General mitigation guidance
Mitigation generally focuses on making HTTP method handling consistent and limiting trust in client-supplied override metadata.
Common defensive patterns include:
- Disable method overrides by default when they are not required
- Allow only an explicit, minimal set of method values when overrides are necessary
- Apply authorization after the final effective method is established
- Ensure proxies, WAFs, gateways, and applications enforce the same method semantics
- Reject conflicting or malformed method metadata rather than normalizing it permissively
- Prefer route and operation authorization that does not depend solely on mutable request headers
- Run gateway and backend components with least-privilege identities and narrowly scoped permissions
How teams detect issues like this
Organizations can look for:
- Static analysis and code review findings involving unrestricted reads of method-override headers
- Request-processing paths that rewrite methods before authorization or routing checks
- Differences between methods evaluated by upstream controls and methods received by backend services
- WAF and proxy policies that allow method overrides without an explicit allowlist
- Telemetry showing unusual method values, conflicting method metadata, or unexpected access to protected operations
- Integration tests that compare authorization outcomes across proxy, gateway, and backend layers
Automated security review tools may help identify client-controlled routing or authorization inputs that are not constrained consistently.

