Skip to content

Commit 03fdee3

Browse files
committed
Cleanup Netty Response Splitting Query
1 parent 8ffe878 commit 03fdee3

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

java/ql/src/Security/CWE/CWE-113/NettyResponseSplitting.ql

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* @id java/netty-http-request-or-response-splitting
1111
* @tags security
1212
* external/cwe/cwe-113
13+
* external/capec/capec-105
1314
*/
1415

1516
import java
@@ -19,33 +20,34 @@ abstract private class InsecureNettyObjectCreation extends ClassInstanceExpr {
1920
int vulnerableArgumentIndex;
2021

2122
InsecureNettyObjectCreation() {
22-
DataFlow::localExprFlow(any(CompileTimeConstantExpr ctce | ctce.getBooleanValue() = false), this.getArgument(vulnerableArgumentIndex))
23+
DataFlow::localExprFlow(any(CompileTimeConstantExpr ctce | ctce.getBooleanValue() = false),
24+
this.getArgument(vulnerableArgumentIndex))
2325
}
2426

2527
abstract string splittingType();
2628
}
2729

2830
abstract private class RequestOrResponseSplittingInsecureNettyObjectCreation extends InsecureNettyObjectCreation {
29-
override string splittingType() { result = "Request-splitting or response-splitting" }
31+
override string splittingType() { result = "Request splitting or response splitting" }
3032
}
3133

3234
/**
3335
* Request splitting can allowing an attacker to inject/smuggle an additional HTTP request into the socket connection.
3436
*/
3537
abstract private class RequestSplittingInsecureNettyObjectCreation extends InsecureNettyObjectCreation {
36-
override string splittingType() { result = "Request-splitting" }
38+
override string splittingType() { result = "Request splitting" }
3739
}
3840

3941
/**
4042
* Response splitting can lead to HTTP vulnerabilities like XSS and cache poisoning.
4143
*/
4244
abstract private class ResponseSplittingInsecureNettyObjectCreation extends InsecureNettyObjectCreation {
43-
override string splittingType() { result = "Response-splitting" }
45+
override string splittingType() { result = "Response splitting" }
4446
}
4547

4648
private class InsecureDefaultHttpHeadersClassInstantiation extends RequestOrResponseSplittingInsecureNettyObjectCreation {
4749
InsecureDefaultHttpHeadersClassInstantiation() {
48-
getConstructedType()
50+
this.getConstructedType()
4951
.hasQualifiedName("io.netty.handler.codec.http",
5052
["DefaultHttpHeaders", "CombinedHttpHeaders"]) and
5153
vulnerableArgumentIndex = 0
@@ -54,28 +56,30 @@ private class InsecureDefaultHttpHeadersClassInstantiation extends RequestOrResp
5456

5557
private class InsecureDefaultHttpResponseClassInstantiation extends ResponseSplittingInsecureNettyObjectCreation {
5658
InsecureDefaultHttpResponseClassInstantiation() {
57-
getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultHttpResponse") and
59+
this.getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultHttpResponse") and
5860
vulnerableArgumentIndex = 2
5961
}
6062
}
6163

6264
private class InsecureDefaultHttpRequestClassInstantiation extends RequestSplittingInsecureNettyObjectCreation {
6365
InsecureDefaultHttpRequestClassInstantiation() {
64-
getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultHttpRequest") and
66+
this.getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultHttpRequest") and
6567
vulnerableArgumentIndex = 3
6668
}
6769
}
6870

6971
private class InsecureDefaultFullHttpResponseClassInstantiation extends ResponseSplittingInsecureNettyObjectCreation {
7072
InsecureDefaultFullHttpResponseClassInstantiation() {
71-
getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultFullHttpResponse") and
73+
this.getConstructedType()
74+
.hasQualifiedName("io.netty.handler.codec.http", "DefaultFullHttpResponse") and
7275
vulnerableArgumentIndex = [2, 3]
7376
}
7477
}
7578

7679
private class InsecureDefaultFullHttpRequestClassInstantiation extends RequestSplittingInsecureNettyObjectCreation {
7780
InsecureDefaultFullHttpRequestClassInstantiation() {
78-
getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultFullHttpRequest") and
81+
this.getConstructedType()
82+
.hasQualifiedName("io.netty.handler.codec.http", "DefaultFullHttpRequest") and
7983
vulnerableArgumentIndex = [3, 4]
8084
}
8185
}

java/ql/src/Security/CWE/CWE-113/ResponseSplitting.qhelp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This can allow an attacker to perform an SSRF-like attack.</p>
1414
<p>In the context of a servlet container, if the user input includes blank lines
1515
and the servlet container does not escape the blank lines,
1616
then a remote user can cause the response to turn into two separate responses.
17-
The remote user can then control one response, which is also HTTP response splitting.</p>
17+
The remote user can then control one or more responses, which is also HTTP response splitting.</p>
1818
</overview>
1919

2020
<recommendation>
@@ -59,5 +59,8 @@ OWASP:
5959
<li>
6060
Wikipedia: <a href="http://en.wikipedia.org/wiki/HTTP_response_splitting">HTTP response splitting</a>.
6161
</li>
62+
<li>
63+
CAPEC: <a href="https://capec.mitre.org/data/definitions/105.html">CAPEC-105: HTTP Request Splitting</a>
64+
</li>
6265
</references>
6366
</qhelp>

0 commit comments

Comments
 (0)