Medium, CVSS 5.3crates.ioPublished
gRPC IpKeyExtractor keys on client-supplied forwarding headers
GHSA-r5c9-r265-ccg3
- Affected
- crates.io tokio-rate-limit >= 0.5.0, < 0.11.1
- Fixed in
- 0.11.1· Vendor fix available
- Issue
- `tonic_middleware::IpKeyExtractor` is documented as rate limiting gRPC requests by client IP address, but on a standard tonic server it keys on client-supplied `x-forwarded-for` and `x-real-ip` headers. In 0.5.0–0.9.1, the extractor reads those headers directly; in 0.10.0–0.11.0, it first checks for a bare `std::net::SocketAddr` request extension—which `tonic::transport::Server` never supplies, as it provides `TcpConnectInfo` instead—and falls back to the same headers. Direct clients can therefore choose their rate-limit key to bypass per-IP rate limits and increase the number of tracked keys; without forwarding headers, 0.5.0–0.9.1 allow requests without limiting them and 0.10.0–0.11.0 reject them by default unless `.fail_open()` is enabled. Applications are affected if they use `GrpcRateLimitLayer` with `IpKeyExtractor` (the `tonic-support` feature). The HTTP middleware's `IpKeyExtractor` reads `ConnectInfo ` and is not affected. Version 0.11.1 fixes `IpKeyExtractor` to honor a…
Recommended action: Upgrade to 0.11.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.