@@ -22,6 +22,8 @@ import semmle.code.cpp.ir.IR
22
22
import semmle.code.cpp.security.FlowSources
23
23
import semmle.code.cpp.models.implementations.Strcat
24
24
25
+ import DataFlow:: PathGraph
26
+
25
27
Expr sinkAsArgumentIndirection ( DataFlow:: Node sink ) {
26
28
result =
27
29
sink .asOperand ( )
@@ -85,7 +87,7 @@ class TaintToConcatenationConfiguration extends TaintTracking::Configuration {
85
87
}
86
88
}
87
89
88
- class ExecTaintConfiguration extends TaintTracking :: Configuration {
90
+ class ExecTaintConfiguration extends TaintTracking2 :: Configuration {
89
91
ExecTaintConfiguration ( ) { this = "ExecTaintConfiguration" }
90
92
91
93
override predicate isSource ( DataFlow:: Node source ) {
@@ -101,17 +103,8 @@ class ExecTaintConfiguration extends TaintTracking::Configuration {
101
103
}
102
104
}
103
105
104
- query predicate nodes = DataFlow:: PathGraph:: nodes / 3 ;
105
-
106
- query predicate edges ( DataFlow:: PathNode a , DataFlow:: PathNode b ) {
107
- DataFlow:: PathGraph:: edges ( a , b ) or
108
- interestingConcatenation ( a .getNode ( ) , b .getNode ( ) ) and
109
- a .getConfiguration ( ) instanceof TaintToConcatenationConfiguration and
110
- b .getConfiguration ( ) instanceof ExecTaintConfiguration
111
- }
112
-
113
106
from
114
- DataFlow:: PathNode sourceNode , DataFlow:: PathNode concatSink , DataFlow :: PathNode concatSource , DataFlow :: PathNode sinkNode , string taintCause , string callChain ,
107
+ DataFlow:: PathNode sourceNode , DataFlow:: PathNode concatSink , DataFlow2 :: PathNode concatSource , DataFlow2 :: PathNode sinkNode , string taintCause , string callChain ,
115
108
TaintToConcatenationConfiguration conf1 , ExecTaintConfiguration conf2
116
109
where
117
110
taintCause = sourceNode .getNode ( ) .( FlowSource ) .getSourceType ( ) and
@@ -122,3 +115,4 @@ where
122
115
select sinkAsArgumentIndirection ( sinkNode .getNode ( ) ) , sourceNode , sinkNode ,
123
116
"This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to " + callChain , sourceNode ,
124
117
"user input (" + taintCause + ")" , concatSource , concatSource .toString ( )
118
+
0 commit comments