Add CWE-113 check for io.netty.handler.codec.http.DefaultHttpHeaders

Closes #2185
This commit is contained in:
Jonathan Leitschuh
2019-10-24 10:27:40 -04:00
parent fe2988ab39
commit dcbd6e0a11
4 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import io.netty.handler.codec.http.DefaultHttpHeaders;
public class ResponseSplitting {
// BAD: Disables the internal response splitting verification
private final DefaultHttpHeaders badHeaders = new DefaultHttpHeaders(false);
// GOOD: Verifies headers passed don't contain CLRF characters
private final DefaultHttpHeaders badHeaders = new DefaultHttpHeaders();
}

View File

@@ -0,0 +1,5 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<include src="ResponseSplitting.qhelp" /></qhelp>

View File

@@ -0,0 +1,7 @@
import java
from ClassInstanceExpr new
where
new.getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultHttpHeaders") and
new.getArgument(0).getProperExpr().(BooleanLiteral).getBooleanValue() = false
select new, "Response-splitting vulnerability due to verification being disabled."

View File

@@ -26,6 +26,13 @@ characters, thus avoiding the potential problem.</p>
<sample src="ResponseSplitting.java" />
</example>
<example>
<p>The following example shows the use of the library 'netty' with HTTP response-splitting verification configurations.
The second way will verify the parameters before using them to build the HTTP response.</p>
<sample src="NettyResponseSplitting.java" />
</example>
<references>
<li>
InfosecWriters: <a href="http://www.infosecwriters.com/Papers/DCrab_HTTP_Response.pdf">HTTP response splitting</a>.