{"id":"GHSA-6v7p-v754-j89v","summary":"HTTP Response Splitting in Styx","details":"# Vulnerability\nStyx is vulnerable to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers (&#39;HTTP Response Splitting&#39;).\n\n# Vulnerable Component\nThe vulnerable component is the `com.hotels.styx.api.HttpHeaders.Builder` due to disabling the HTTP Header validation built into Netty in these locations:\n\nhttps://github.com/HotelsDotCom/styx/blob/e1d578e9b9c38df9cd19c21dc2eb9b949d85b558/components/api/src/main/java/com/hotels/styx/api/HttpHeaders.java#L145\n\nhttps://github.com/HotelsDotCom/styx/blob/e1d578e9b9c38df9cd19c21dc2eb9b949d85b558/components/api/src/main/java/com/hotels/styx/api/HttpHeaders.java#L145\n\n`new DefaultHttpHeaders(false)` disables the built-in validation in Netty. Either use the default constructor or `new DefaultHttpHeaders(true`  instead.\n\nAdditionally, another vulnerable component is the StyxToNettyResponseTranslator due to also disabling the HTTP Header validation built into netty in this location.\n\nhttps://github.com/HotelsDotCom/styx/blob/8d60e5493e65d0d536afc0b350dcb02d24e0f7a7/components/server/src/main/java/com/hotels/styx/server/netty/connectors/StyxToNettyResponseTranslator.java#L30\n\n `DefaultHttpResponse nettyResponse = new DefaultHttpResponse(version, httpResponseStatus, false); `\n`new DefaultHttpResponse(version, httpResponseStatus, false);` disables the built-in validation in Netty. Please use the constructor `new DefaultHttpResponse(version, httpResponseStatus, true);`\n\n# Proof of Concept\nThe following test plugin proves that there is no header validation occurring.\n\n```java\n    static class VulnerablePlugin implements Plugin {\n\n        @Override\n        public Eventual&lt;LiveHttpResponse&gt; intercept(LiveHttpRequest request, Chain chain) {\n            String header = request.queryParam(&quot;header-value&quot;).get();\n            LiveHttpRequest newRequest = request.newBuilder()\n                .header(&quot;myRequestHeader&quot;, header)\n                .build();\n            return chain.proceed(newRequest).map(response -&gt;\n                response.newBuilder().header(&quot;myResponseHeader&quot;, header).build()\n            ) ;\n        }\n\n    }\n\n    @Test\n    public void simpleHeaderInjectionVulnerabilityPOC() {\n        Plugin vulnerablePlugin = new VulnerablePlugin();\n        // a simple way to mock the downstream system\n        HttpInterceptor.Chain chain = request -&gt; {\n            assertThat(request.header(&quot;myRequestHeader&quot;).orElse(null), is(&quot;test\\r\\nAnother: CRLF_Injection&quot;));\n            return Eventual.of(response(OK).build());\n        };\n\n        // an example request you expect your plugin to receive\n        String encodedGet = URLEncoder.encode(&quot;test\\r\\nAnother: CRLF_Injection&quot;);\n        LiveHttpRequest request = get(&quot;/foo?header-value=&quot; + encodedGet)\n            .build();\n\n        // since this is a test, we want to wait for the response\n        LiveHttpResponse response = Mono.from(vulnerablePlugin.intercept(request, chain)).block();\n\n        assertThat(response.header(&quot;myResponseHeader&quot;).orElse(null), is(&quot;test\\r\\nAnother: CRLF_Injection&quot;));\n    }\n```\nAdditionally, if you run this LiveHttpResponse from this test through the `StyxToNettyResponseTranslator::toNettyResponse`, ideally, it would have caused an exception to be thrown. In its current state, it does not.\n\n# Similar Vulnerabilities\nThere have been reports of similar vulnerabilities in other popular libraries.\n\nGHSA-35fr-h7jr-hh86 -&gt; CVE-2019-16771\nGHSA-mvqp-q37c-wf9j -&gt; CVE-2019-17513\n\n\n# Finding\nThis vulnerability was found due to this query that [Jonathan Leitschuh](https://twitter.com/jlleitschuh) contributed to the Semmle QL project.\nhttps://lgtm.com/rules/1510696449842/alerts/","aliases":["CVE-2020-6858"],"modified":"2026-07-08T06:00:59.240256745Z","published":"2020-03-03T15:32:03Z","database_specific":{"github_reviewed":true,"github_reviewed_at":"2020-03-03T15:31:22Z","nvd_published_at":null,"cwe_ids":["CWE-74"],"severity":"MODERATE"},"references":[{"type":"WEB","url":"https://github.com/HotelsDotCom/styx/security/advisories/GHSA-6v7p-v754-j89v"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2020-6858"},{"type":"WEB","url":"https://twitter.com/JLLeitschuh"}],"affected":[{"package":{"name":"com.hotels.styx:styx-api","ecosystem":"Maven","purl":"pkg:maven/com.hotels.styx/styx-api"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.0.0-rc1"}]}],"versions":["0.0.1.beta6","0.7.10","0.7.3","0.7.4","0.7.5","0.7.6","0.7.7","0.7.8","0.7.9","styx-1.0.0.beta2","v0.0.5"],"database_specific":{"last_known_affected_version_range":"\u003c= 1.0.0.beta8","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/03/GHSA-6v7p-v754-j89v/GHSA-6v7p-v754-j89v.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"}]}