Skip to content

CWE-113: DefaultHttpHeaders HTTP Response Splitting Query #2185

Closed

Description

@JLLeitschuh

I've been finding various places that are using io.netty.handler.codec.http.DefaultHttpHeaders with validation turned off, thus exposing those libraries to HTTP Response splitting.

Below is a simple query to find these cases:

import java

from ClassInstanceExpr new
where new.getConstructedType().hasQualifiedName("io.netty.handler.codec.http", "DefaultHttpHeaders")
  and new.getArgument(0).getProperExpr() instanceof BooleanLiteral
  and new.getArgument(0).getProperExpr().(BooleanLiteral).getBooleanValue() = false
select new

This query isn't really general, it's specific to this class however, it may still be valuable.

If I wanted to submit this as a query, would it be appropriate to name the file so that it is associated with the library impacted:
https://github.com/Semmle/ql/tree/master/java/ql/src/Security/CWE/CWE-113


Related CVE from my research:

Documentation improvement in netty:


If anyone at Semmle wants to use this query as-is and can drop it in quickly, feel free to integrate it.

Activity

  1. added
    question
    on Oct 23, 2019
  2. aschackmull commented on Oct 24, 2019

    @aschackmull
    Contributor

    I think that looks like a fine contribution. Would you mind submitting it as a PR? You can place it in a new file, say NettyResponseSplitting.ql, in https://github.com/Semmle/ql/tree/master/java/ql/src/Security/CWE/CWE-113.

  3. aschackmull commented on Oct 24, 2019

    @aschackmull
    Contributor

    Btw. you can remove the new.getArgument(0).getProperExpr() instanceof BooleanLiteral line to simplify the query a bit, as the cast to BooleanLiteral in the line below implies this. Unlike other languages, casts in QL won't fail with an exception; failing a cast simply means that the proposition doesn't hold.

  4. added a commit that references this issue on Oct 24, 2019
    dcbd6e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

question

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions