|
| 1 | +/** |
| 2 | + * Provides default sources, sinks, and sanitizers for detecting |
| 3 | + * "HTTP Header injection" vulnerabilities, as well as extension |
| 4 | + * points for adding your own. |
| 5 | + */ |
| 6 | + |
| 7 | +import python |
| 8 | +private import semmle.python.Concepts |
| 9 | +private import semmle.python.dataflow.new.DataFlow |
| 10 | +private import semmle.python.dataflow.new.TaintTracking |
| 11 | +private import semmle.python.dataflow.new.RemoteFlowSources |
| 12 | + |
| 13 | +/** |
| 14 | + * Provides default sources, sinks, and sanitizers for detecting |
| 15 | + * "HTTP Header injection" vulnerabilities, as well as extension |
| 16 | + * points for adding your own. |
| 17 | + */ |
| 18 | +module HttpHeaderInjection { |
| 19 | + /** |
| 20 | + * A data flow source for "HTTP Header injection" vulnerabilities. |
| 21 | + */ |
| 22 | + abstract class Source extends DataFlow::Node { } |
| 23 | + |
| 24 | + /** |
| 25 | + * A data flow sink for "HTTP Header injection" vulnerabilities. |
| 26 | + */ |
| 27 | + abstract class Sink extends DataFlow::Node { } |
| 28 | + |
| 29 | + /** |
| 30 | + * A data flow sanitizer for "HTTP Header injection" vulnerabilities. |
| 31 | + */ |
| 32 | + abstract class Sanitizer extends DataFlow::Node { } |
| 33 | + |
| 34 | + /** |
| 35 | + * A source of remote user input, considered as a flow source. |
| 36 | + */ |
| 37 | + class RemoteFlowSourceAsSource extends Source, RemoteFlowSource { } |
| 38 | + |
| 39 | + /** |
| 40 | + * A HTTP header write, considered as a flow sink. |
| 41 | + */ |
| 42 | + class HeaderWriteAsSink extends Sink { |
| 43 | + HeaderWriteAsSink() { |
| 44 | + exists(Http::Server::ResponseHeaderWrite headerDeclaration | |
| 45 | + this in [headerDeclaration.getNameArg(), headerDeclaration.getValueArg()] |
| 46 | + ) |
| 47 | + } |
| 48 | + } |
| 49 | +} |
0 commit comments