@@ -28,17 +28,15 @@ import cpp
28
28
import semmle.code.cpp.ir.dataflow.TaintTracking
29
29
import semmle.code.cpp.models.interfaces.FlowSource
30
30
import semmle.code.cpp.security.OutputWrite
31
- import DataFlow :: PathGraph
31
+ import PotentiallyExposedSystemData :: PathGraph
32
32
import SystemData
33
33
34
- class PotentiallyExposedSystemDataConfiguration extends TaintTracking:: Configuration {
35
- PotentiallyExposedSystemDataConfiguration ( ) { this = "PotentiallyExposedSystemDataConfiguration" }
36
-
37
- override predicate isSource ( DataFlow:: Node source ) {
34
+ module PotentiallyExposedSystemDataConfiguration implements DataFlow:: ConfigSig {
35
+ predicate isSource ( DataFlow:: Node source ) {
38
36
source = any ( SystemData sd | sd .isSensitive ( ) ) .getAnExpr ( )
39
37
}
40
38
41
- override predicate isSink ( DataFlow:: Node sink ) {
39
+ predicate isSink ( DataFlow:: Node sink ) {
42
40
exists ( OutputWrite ow , Expr child | child = ow .getASource ( ) .getAChild * ( ) |
43
41
// Most sinks receive a pointer as an argument (for example `printf`),
44
42
// and we use an indirect sink for those.
@@ -53,9 +51,10 @@ class PotentiallyExposedSystemDataConfiguration extends TaintTracking::Configura
53
51
}
54
52
}
55
53
56
- from
57
- PotentiallyExposedSystemDataConfiguration config , DataFlow:: PathNode source ,
58
- DataFlow:: PathNode sink
59
- where config .hasFlowPath ( source , sink )
54
+ module PotentiallyExposedSystemData =
55
+ TaintTracking:: Make< PotentiallyExposedSystemDataConfiguration > ;
56
+
57
+ from PotentiallyExposedSystemData:: PathNode source , PotentiallyExposedSystemData:: PathNode sink
58
+ where PotentiallyExposedSystemData:: hasFlowPath ( source , sink )
60
59
select sink , source , sink , "This operation potentially exposes sensitive system data from $@." ,
61
60
source , source .getNode ( ) .toString ( )
0 commit comments