MEDIUM · CVSS 3.1 5.3

GHSA-r5c9-r265-ccg3: gRPC `IpKeyExtractor` keys on client-supplied forwarding headers

Published 2026-11-19 · Updated 2026-11-20 · Also known as RUSTSEC-2026-0584

Summary

The IpKeyExtractor in tokio-rate-limit incorrectly trusts client-supplied forwarding headers, allowing remote attackers to bypass rate limits. Users of the GrpcRateLimitLayer with the tonic-support feature should update to version 0.11.1.

Who is affected

Applications using GrpcRateLimitLayer with IpKeyExtractor are affected, as the component defaults to headers like x-forwarded-for or x-real-ip instead of the actual client IP. An attacker can manipulate these headers to choose their own rate-limit key, either bypassing limits or exhausting tracking resources. Versions 0.5.0 through 0.11.0 are susceptible to this logic flaw.

Exploitability

The vulnerability is remotely exploitable without authentication or user interaction. With a CVSS score of 5.3, it carries a moderate availability impact; CISA KEV data is not available, and exploitation status is unknown.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-21. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
crates.io tokio-rate-limit >= 0.5.0, < 0.11.1 0.11.1 cargo update -p tokio-rate-limit --precise 0.11.1

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Attack vectorNetwork
Attack complexityLow
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityNone
IntegrityNone
AvailabilityLow

FAQ

Is the standard HTTP middleware for IpKeyExtractor affected?

No, the HTTP middleware reads ConnectInfo<SocketAddr> directly and remains unaffected.

What happens if I cannot upgrade immediately?

You can restrict backend access so that a trusted proxy strips all incoming forwarding headers and injects a single verified header value, or write a custom extractor that relies on tonic's internal connection information.

What is the primary difference in version 0.11.1?

Version 0.11.1 now prioritizes the server-supplied SocketAddr and reads the TCP peer address from tonic's TcpConnectInfo, removing the reliance on potentially malicious client-supplied headers.

Original advisory description
`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<SocketAddr>` and is not affected. Version 0.11.1 fixes `IpKeyExtractor` to honor a server-supplied `SocketAddr` override first and then read the TCP peer address from tonic's `TcpConnectInfo` (which `tonic::transport::Server` attaches to plaintext connections and connections using its built-in TLS), without ever reading forwarding headers. Deployments behind a trusted proxy can use the new opt-in `ForwardedIpKeyExtractor`, which reads a single configured header (`x-forwarded-for` or `x-real-ip`) and is only correct when that proxy sets the header as documented. If you cannot upgrade to 0.11.1, use a custom key extractor that reads the peer IP from tonic's connection information for the transport in use (including TLS) and rejects requests without a verified peer address before invoking the limiter, or restrict backend access to a trusted proxy that strips all incoming `x-forwarded-for` and `x-real-ip` fields and sets one `x-forwarded-for` value to the verified client IP on every request.

References

Source records: RUSTSEC-2026-0584 (OSV.dev).