-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathStoredXPathInjection.ql
More file actions
25 lines (22 loc) · 1.01 KB
/
StoredXPathInjection.ql
File metadata and controls
25 lines (22 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @name Stored XPath injection
* @description Building an XPath expression from stored data which may have been provided by the
* user is vulnerable to insertion of malicious code by the user.
* @kind path-problem
* @problem.severity error
* @precision medium
* @id cs/xml/stored-xpath-injection
* @tags security
* external/cwe/cwe-643
*/
import csharp
import semmle.code.csharp.security.dataflow.flowsources.Stored
import semmle.code.csharp.security.dataflow.XPathInjection
import semmle.code.csharp.dataflow.DataFlow::DataFlow::PathGraph
class StoredTaintTrackingConfiguration extends XPathInjection::TaintTrackingConfiguration {
override predicate isSource(DataFlow::Node source) { source instanceof StoredFlowSource }
}
from StoredTaintTrackingConfiguration c, DataFlow::PathNode source, DataFlow::PathNode sink
where c.hasFlowPath(source, sink)
select sink.getNode(), source, sink, "$@ flows to here and is used in an XPath expression.",
source.getNode(), "Stored user-provided value"