Vulnerabilities in pkg:maven/io.ratpack/ratpack-core

PACKAGE
Advisory Identifier: GHSA-mvqp-q37c-wf9j
Advisory Summary

CVE-2019-17513 is a HIGH (CVSS 7.5) ratpack-core vulnerable to improper neutralization vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Ratpack core libraries in the Maven ecosystem. The issue involves ratpack-core vulnerable to improper neutralization of special elements in output ('injection'). Remediation is available by upgrading affected packages to version 1.7.5.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/io.ratpack/ratpack-core

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/io.ratpack/ratpack-core. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-mvqp-q37c-wf9j CVE-2019-17513 HIGH io.ratpack:ratpack-core vulnerable to Improper Neutralization of Special Elements in Output ('Injection')
GHSA-hc33-32vw-rpp9 CVE-2021-29485 CRITICAL Remote Code Execution Vulnerability in Session Storage
GHSA-w6rq-6h34-vh7q CVE-2021-29479 HIGH Cached redirect poisoning via X-Forwarded-Host header
GHSA-r2wf-q3x4-hrv9 CVE-2019-10770 MODERATE Default development error handler in Ratpack is vulnerable to HTML content injection (XSS)

CVE-2019-17513 at a Glance

CVE Identifier CVE-2019-17513
GHSA Identifier GHSA-mvqp-q37c-wf9j
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Ratpack core
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 7.5

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

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

How to Fix CVE-2019-17513

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.7.5
<dependency>
    <groupId>io.ratpack</groupId>
    <artifactId>ratpack-core</artifactId>
    <version>1.7.5</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-2019-17513, 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.7.5), 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-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. 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

## CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting') Versions of Ratpack 0.9.1 through and including 1.7.4 are vulnerable to [HTTP Response Splitting](https://www.owasp.org/index.php/HTTP_Response_Splitting), if untrusted and unsanitized data is used to populate the headers of an HTTP response. An attacker can utilize this vulnerability to have the server issue any HTTP response they specify. If your application uses arbitrary user input as the value of a response header it is vulnerable. If your application does not use arbitrary values as response header values, it is not vulnerable. Previously, Ratpack did not validate response header values. Now, adding a header value that contains the header value termination characters (CRLF) produces a runtime exception. Since there is no mechanism for escaping or encoding the termination characters in a String, a runtime exception is necessary. As potentially dangerous values now cause runtime exceptions, it is a good idea to continue to validate and sanitize any user-supplied values being used as response headers. We would like to thank [Jonathan Leitschuh](https://github.com/JLLeitschuh) for reporting this vulnerability. ### Vulnerable Example The following example server uses a query parameter value as a response header, without validating or sanitizing it. ```java RatpackServer startedServer = RatpackServer.start(server -> { server.handlers(chain -> chain.all(ctx -> { // User supplied query parameter String header = ctx.getRequest().getQueryParams().get("header"); // User supplied data used to populate a header value. ctx.header("the-header", header) .render("OK!"); })); }); ``` Sending a request to the server with the following value for the `header` query param would allow the execution of arbitrary Javascript. ``` Content-Type: text/html X-XSS-Protection: 0 <script>alert(document.domain)</script> ``` ### Impact - Cross-User Defacement - Cache Poisoning - Cross-Site Scripting - Page Hijacking ### Patches This vulnerability has been patched in Ratpack version 1.7.5. ### Root Cause The root cause was due to using the netty `DefaultHttpHeaders` object with verification disabled. https://github.com/ratpack/ratpack/blob/af1e8c8590f164d7dd84d4212886fad4ead99080/ratpack-core/src/main/java/ratpack/server/internal/NettyHandlerAdapter.java#L159 This vulnerability is now more clearly documented in the Netty documentation: https://github.com/netty/netty/pull/9646 ### Workarounds The workaround for this vulnerability is to either not use arbitrary input as response header values or validate such values before being used to ensure they don't contain a carriage return and/or line feed characters. ### References - [CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting')](https://cwe.mitre.org/data/definitions/113.html) - Fix commit: https://github.com/ratpack/ratpack/commit/efb910d38a96494256f36675ef0e5061097dd77d ### For more information If you have any questions or comments about this advisory: * Open an issue in [ratpack/ratpack](https://github.com/ratpack/ratpack/issues) * Ask in our [Slack channel](https://slack-signup.ratpack.io/)

CVE-2019-17513 Affected Ratpack core Versions

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

References

Frequently Asked Questions

What is CVE-2019-17513?
CVE-2019-17513 is a security vulnerability in Ratpack core involving ratpack-core vulnerable to Improper Neutralization of Special Elements in Output ('Injection') under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Ratpack core versions are affected?
Affected versions include releases prior to 1.7.5 across affected packages: io.ratpack:ratpack-core.
What version fixes CVE-2019-17513?
Upgrading to 1.7.5 (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.7.5. Upgrade your dependency to 1.7.5 or later.
What is the CVSS score of CVE-2019-17513?
CVE-2019-17513 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2019-17513?
CVE-2019-17513 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check Maven dependencies for CVE-2019-17513?
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-mvqp-q37c-wf9j",
  "modified" : "2022-09-17T00:25:18Z",
  "published" : "2019-10-21T16:08:43Z",
  "aliases" : [ "CVE-2019-17513" ],
  "summary" : "io.ratpack:ratpack-core vulnerable to Improper Neutralization of Special Elements in Output ('Injection')",
  "details" : "## CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting')\n\nVersions of Ratpack 0.9.1 through and including 1.7.4 are vulnerable to [HTTP Response Splitting](https://www.owasp.org/index.php/HTTP_Response_Splitting), \nif untrusted and unsanitized data is used to populate the headers of an HTTP response.\nAn attacker can utilize this vulnerability to have the server issue any HTTP response they specify.\n\nIf your application uses arbitrary user input as the value of a response header it is vulnerable.\nIf your application does not use arbitrary values as response header values, it is not vulnerable.\n\nPreviously, Ratpack did not validate response header values.\nNow, adding a header value that contains the header value termination characters (CRLF) produces a runtime exception.\nSince there is no mechanism for escaping or encoding the termination characters in a String, a runtime exception is necessary.\n\nAs potentially dangerous values now cause runtime exceptions, it is a good idea to continue to validate and sanitize any user-supplied values being used as response headers.\n\nWe would like to thank [Jonathan Leitschuh](https://github.com/JLLeitschuh) for reporting this vulnerability.\n\n### Vulnerable Example\n\nThe following example server uses a query parameter value as a response header, without validating or sanitizing it.\n```java\nRatpackServer startedServer =  RatpackServer.start(server -> {\n    server.handlers(chain -> chain.all(ctx -> {\n        // User supplied query parameter\n        String header = ctx.getRequest().getQueryParams().get(\"header\");\n        // User supplied data used to populate a header value.\n        ctx.header(\"the-header\", header)\n            .render(\"OK!\");\n    }));\n});\n```\n\nSending a request to the server with the following value for the `header` query param would allow the execution of arbitrary Javascript.\n\n```\nContent-Type: text/html\nX-XSS-Protection: 0\n\n<script>alert(document.domain)</script>\n```\n\n### Impact\n\n- Cross-User Defacement\n- Cache Poisoning\n- Cross-Site Scripting\n- Page Hijacking\n\n### Patches\n\nThis vulnerability has been patched in Ratpack version 1.7.5.\n\n### Root Cause\n\nThe root cause was due to using the netty `DefaultHttpHeaders` object with verification disabled.\n\nhttps://github.com/ratpack/ratpack/blob/af1e8c8590f164d7dd84d4212886fad4ead99080/ratpack-core/src/main/java/ratpack/server/internal/NettyHandlerAdapter.java#L159\n\nThis vulnerability is now more clearly documented in the Netty documentation: https://github.com/netty/netty/pull/9646\n\n### Workarounds\n\nThe workaround for this vulnerability is to either not use arbitrary input as response header values or validate such values before being used to ensure they don't contain a carriage return and/or line feed characters.\n\n### References\n\n - [CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting')](https://cwe.mitre.org/data/definitions/113.html)\n - Fix commit: https://github.com/ratpack/ratpack/commit/efb910d38a96494256f36675ef0e5061097dd77d\n \n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in [ratpack/ratpack](https://github.com/ratpack/ratpack/issues)\n* Ask in our [Slack channel](https://slack-signup.ratpack.io/)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "io.ratpack:ratpack-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.7.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ratpack/ratpack/security/advisories/GHSA-mvqp-q37c-wf9j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-17513"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ratpack/ratpack/commit/c560a8d10cb8bdd7a526c1ca2e67c8f224ca23ae"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ratpack/ratpack/commit/efb910d38a96494256f36675ef0e5061097dd77d"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-mvqp-q37c-wf9j"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ratpack/ratpack"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ratpack/ratpack/releases/tag/v1.7.5"
  }, {
    "type" : "WEB",
    "url" : "https://ratpack.io/versions/1.7.5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:47:20Z",
    "nvd_published_at" : null
  }
}