Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW12cXAtcTM3Yy13Zjlq
io.ratpack:ratpack-core vulnerable to Improper Neutralization of Special Elements in Output ('Injection')
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,
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 for reporting this vulnerability.
Vulnerable Example
The following example server uses a query parameter value as a response header, without validating or sanitizing it.
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.
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')
- 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
- Ask in our Slack channel
JSON: https://advisories.ecosyste.ms/api/v1/advisories/MDE2OlNlY3VyaXR5QWR2aXNvcnlHSFNBLW12cXAtcTM3Yy13Zjlq
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: about 5 years ago
Updated: almost 2 years ago
CVSS Score: 7.5
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Identifiers: GHSA-mvqp-q37c-wf9j, CVE-2019-17513
References:
- https://github.com/ratpack/ratpack/security/advisories/GHSA-mvqp-q37c-wf9j
- https://nvd.nist.gov/vuln/detail/CVE-2019-17513
- https://github.com/ratpack/ratpack/commit/c560a8d10cb8bdd7a526c1ca2e67c8f224ca23ae
- https://github.com/ratpack/ratpack/commit/efb910d38a96494256f36675ef0e5061097dd77d
- https://github.com/advisories/GHSA-mvqp-q37c-wf9j
- https://github.com/ratpack/ratpack/releases/tag/v1.7.5
- https://ratpack.io/versions/1.7.5
Blast Radius: 17.6
Affected Packages
maven:io.ratpack:ratpack-core
Dependent packages: 29Dependent repositories: 224
Downloads:
Affected Version Ranges: < 1.7.5
Fixed in: 1.7.5
All affected versions: 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 0.9.9, 0.9.10, 0.9.11, 0.9.12, 0.9.13, 0.9.14, 0.9.15, 0.9.16, 0.9.17, 0.9.18, 0.9.19, 1.0.0, 1.1.0, 1.1.1, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6.0, 1.6.1, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4
All unaffected versions: 1.7.5, 1.7.6, 1.8.0, 1.8.1, 1.8.2, 1.9.0