HIGH 7.0

CVE-2021-29479

Cached redirect poisoning via X-Forwarded-Host header

Description

A user supplied X-Forwarded-Host header can be used to perform cache poisoning of a cache fronting a Ratpack server if the cache key does not include the X-Forwarded-Host header as a cache key.

Users are only vulnerable if they do not configure a custom PublicAddress instance. A custom PublicAddress can be specified by using ServerConfigBuilder::publicAddress. For versions prior to 1.9.0, by default, Ratpack utilizes an inferring version of PublicAddress which is vulnerable.

Impact

This can be used to perform redirect cache poisoning where an attacker can force a cached redirect to redirect to their site instead of the intended redirect location.

Patches

As of Ratpack 1.9.0, two changes have been made that mitigate this vulnerability:

  1. The default PublicAddress implementation no longer infers the address from the request context, instead relying on the configured bind host/port
  2. Relative redirects issued by the application are no longer absolutized; they are passed through as-is

Workarounds

In production, ensure that ServerConfigBuilder::publicAddress correctly configures the server.

References

  • https://portswigger.net/web-security/web-cache-poisoning

Affected Maven artifacts (1)

ArtifactAffected versionsFixed in
io.ratpack » ratpack-core
< 1.9.0
1.9.0

Blast radius

1affected artifacts
73affected versions
173dependent artifacts (est.)
3,700dependent versions

52% of the dependent artifacts (90) still pull an affected version in their latest release.

DepthDependent versions
Direct
1,114
2 hops
1,697
3 hops
558
4 hops
295
5 hops
36

Most used dependents

Computed from the dependency graph of build 20261128.0605 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.

References

Advisorynvd.nist.gov
Packagegithub.com
Webgithub.com
Webportswigger.net