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:
- The default PublicAddress implementation no longer infers the address from the request context, instead relying on the configured bind host/port
- 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)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| io.ratpack » ratpack-core | < 1.9.0 | 1.9.0 |
Blast radius
52% of the dependent artifacts (90) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 1,114 |
| 2 hops | 1,697 |
| 3 hops | 558 |
| 4 hops | 295 |
| 5 hops | 36 |
Most used dependents
- io.ratpack » ratpack-guice53 usages
- io.ratpack » ratpack-test17 usages
- com.github.jruby-gradle » jruby-gradle-plugin16 usages
- io.ratpack » ratpack-groovy15 usages
- io.ratpack » ratpack-groovy-test15 usages
- io.ratpack » ratpack-rx11 usages
- org.asciidoctor » asciidoctor-gradle-jvm-slides10 usages
- org.asciidoctor » asciidoctor-gradle-jvm-gems9 usages
- org.asciidoctor » asciidoctor5-jvm-core-plugin9 usages
- com.onresolve.jira.groovy » groovyrunner7 usages
- com.github.mstream-trader » commons-config7 usages
- org.http4k » http4k7 usages
- com.github.mstream-trader » commons-test6 usages
- io.ratpack » ratpack-session5 usages
- me.drmaas » ratpack-kotlin-test5 usages
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
| Advisory | NVD CVE-2021-29479 | nvd.nist.gov |
| Package | ratpack/ratpack | github.com |
| Web | ratpack/ratpack advisory GHSA-w6rq-6h34-vh7q | github.com |
| Web | web-security/web-cache-poisoning | portswigger.net |
