CVE-2021-29479: Ratpack core Cached Redirect Poisoning Vulnerability

HIGH
Advisory Identifier: GHSA-w6rq-6h34-vh7q
CVSS 7.0
CWE-807
Published
Advisory Summary

CVE-2021-29479 is a HIGH (CVSS 7.0) cached redirect poisoning vulnerability (CWE-807: Reliance on Untrusted Inputs in a Security Decision) affecting Ratpack core libraries in the Maven ecosystem. The issue involves cached redirect poisoning via x-forwarded-host header. Remediation is available by upgrading affected packages to version 1.9.0.

CVE-2021-29479 at a Glance

CVE Identifier CVE-2021-29479
GHSA Identifier GHSA-w6rq-6h34-vh7q
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-807: Reliance on Untrusted Inputs in a Security Decision
Affected Product Ratpack core
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2021-29479

To remediate this vulnerability, upgrade all affected Ratpack core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

io.ratpack:ratpack-core fixed: 1.9.0
<dependency>
    <groupId>io.ratpack</groupId>
    <artifactId>ratpack-core</artifactId>
    <version>1.9.0</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=io.ratpack

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2021-29479, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=io.ratpack

Analyze the terminal output to locate any version of Ratpack core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.0), your application is affected.

Note: The mvn dependency:tree -Dincludes=io.ratpack command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-807: Reliance on Untrusted Inputs in a Security Decision, where the product uses a protection mechanism that relies on the existence or values of an input, but the input can be modified by an untrusted actor in a way that bypasses the protection mechanism. In Ratpack core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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](https://ratpack.io/manual/current/api/ratpack/server/ServerConfigBuilder.html#publicAddress-java.net.URI-). 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](https://ratpack.io/manual/current/api/ratpack/server/ServerConfigBuilder.html#publicAddress-java.net.URI-) correctly configures the server. ### References - https://portswigger.net/web-security/web-cache-poisoning

CVE-2021-29479 Affected Ratpack core Versions

1 component(s)
Fixed Versions:
1.9.0
Product / Package Ecosystem Affected Versions Fixed Version
io.ratpack:ratpack-core
Maven
< 1.9.0
1.9.0

References

Frequently Asked Questions

What is CVE-2021-29479?
CVE-2021-29479 is a security vulnerability in Ratpack core involving Cached redirect poisoning via X-Forwarded-Host header under CWE-807: Reliance on Untrusted Inputs in a Security Decision.
Which Ratpack core versions are affected?
Affected versions include releases prior to 1.9.0 across affected packages: io.ratpack:ratpack-core.
What version fixes CVE-2021-29479?
Upgrading to 1.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ratpack-core affected?
Yes, io.ratpack:ratpack-core is affected in releases prior to 1.9.0. Upgrade your dependency to 1.9.0 or later.
What is the CVSS score of CVE-2021-29479?
CVE-2021-29479 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L.
What CWE is associated with CVE-2021-29479?
CVE-2021-29479 is classified under CWE-807: Reliance on Untrusted Inputs in a Security Decision (The product uses a protection mechanism that relies on the existence or values of an input, but the input can be modified by an untrusted actor in a way that bypasses the protection mechanism.).
How can I check Maven dependencies for CVE-2021-29479?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=io.ratpack'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w6rq-6h34-vh7q",
  "modified" : "2021-09-01T19:32:52Z",
  "published" : "2021-07-01T17:02:38Z",
  "aliases" : [ "CVE-2021-29479" ],
  "summary" : "Cached redirect poisoning via X-Forwarded-Host header",
  "details" : "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.\n\nUsers are only vulnerable if they do not configure a custom `PublicAddress` instance. A custom `PublicAddress` can be specified by using [ServerConfigBuilder::publicAddress](https://ratpack.io/manual/current/api/ratpack/server/ServerConfigBuilder.html#publicAddress-java.net.URI-). For versions prior to 1.9.0, by default, Ratpack utilizes an inferring version of `PublicAddress` which is vulnerable.\n\n### Impact\n\nThis 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.\n\n### Patches\n\nAs of Ratpack 1.9.0, two changes have been made that mitigate this vulnerability:\n\n1. The default PublicAddress implementation no longer infers the address from the request context, instead relying on the configured bind host/port\n2. Relative redirects issued by the application are no longer absolutized; they are passed through as-is\n\n### Workarounds\n\nIn production, ensure that [ServerConfigBuilder::publicAddress](https://ratpack.io/manual/current/api/ratpack/server/ServerConfigBuilder.html#publicAddress-java.net.URI-) correctly configures the server.\n\n### References\n - https://portswigger.net/web-security/web-cache-poisoning",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.ratpack:ratpack-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ratpack/ratpack/security/advisories/GHSA-w6rq-6h34-vh7q"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29479"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ratpack/ratpack"
  }, {
    "type" : "WEB",
    "url" : "https://portswigger.net/web-security/web-cache-poisoning"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-807" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-06-30T17:50:31Z",
    "nvd_published_at" : "2021-06-29T15:15:00Z"
  }
}