|
2 | 2 | * @name Stored cross-site scripting |
3 | 3 | * @description Writing input from the database directly to a web page indicates a cross-site |
4 | 4 | * scripting vulnerability if the data was originally user-provided. |
5 | | - * @kind problem |
| 5 | + * @kind path-problem |
6 | 6 | * @problem.severity error |
7 | 7 | * @precision medium |
8 | 8 | * @id cs/web/stored-xss |
|
13 | 13 | import csharp |
14 | 14 | import semmle.code.csharp.security.dataflow.flowsources.Stored |
15 | 15 | import semmle.code.csharp.security.dataflow.XSS::XSS |
| 16 | +import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph |
16 | 17 |
|
17 | 18 | class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration { |
18 | 19 | override predicate isSource(DataFlow::Node source) { |
19 | 20 | source instanceof StoredFlowSource |
20 | 21 | } |
21 | 22 | } |
22 | 23 |
|
23 | | -from StoredTaintTrackingConfiguration c, StoredFlowSource source, Sink sink, string explanation |
24 | | -where c.hasFlow(source, sink) |
| 24 | +from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink, string explanation |
| 25 | +where c.hasFlowPath(source, sink) |
25 | 26 | and |
26 | | - if exists(sink.explanation()) |
27 | | - then explanation = ": " + sink.explanation() + "." |
| 27 | + if exists(sink.getNode().(Sink).explanation()) |
| 28 | + then explanation = ": " + sink.getNode().(Sink).explanation() + "." |
28 | 29 | else explanation = "." |
29 | | -select sink, "$@ flows to here and is written to HTML or javascript" + explanation, source, "Stored user-provided value" |
| 30 | +select sink.getNode(), source, sink, |
| 31 | + "$@ flows to here and is written to HTML or JavaScript" + explanation, source.getNode(), "Stored user-provided value" |
0 commit comments