@@ -22,6 +22,8 @@ import semmle.code.cpp.ir.IR
2222import semmle.code.cpp.security.FlowSources
2323import semmle.code.cpp.models.implementations.Strcat
2424
25+ import DataFlow:: PathGraph
26+
2527Expr sinkAsArgumentIndirection ( DataFlow:: Node sink ) {
2628 result =
2729 sink .asOperand ( )
@@ -85,7 +87,7 @@ class TaintToConcatenationConfiguration extends TaintTracking::Configuration {
8587 }
8688}
8789
88- class ExecTaintConfiguration extends TaintTracking :: Configuration {
90+ class ExecTaintConfiguration extends TaintTracking2 :: Configuration {
8991 ExecTaintConfiguration ( ) { this = "ExecTaintConfiguration" }
9092
9193 override predicate isSource ( DataFlow:: Node source ) {
@@ -101,17 +103,8 @@ class ExecTaintConfiguration extends TaintTracking::Configuration {
101103 }
102104}
103105
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-
113106from
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 ,
115108 TaintToConcatenationConfiguration conf1 , ExecTaintConfiguration conf2
116109where
117110 taintCause = sourceNode .getNode ( ) .( FlowSource ) .getSourceType ( ) and
@@ -122,3 +115,4 @@ where
122115select sinkAsArgumentIndirection ( sinkNode .getNode ( ) ) , sourceNode , sinkNode ,
123116 "This argument to an OS command is derived from $@, dangerously concatenated into $@, and then passed to " + callChain , sourceNode ,
124117 "user input (" + taintCause + ")" , concatSource , concatSource .toString ( )
118+
0 commit comments