@@ -24,17 +24,44 @@ class PostValidation extends DataFlow::FlowState {
24
24
*
25
25
* This configuration uses two flow states, `PreValidation` and `PostValidation`,
26
26
* to track the requirement that a logical validation has been performed before the Unicode Transformation.
27
+ * DEPRECATED: Use `UnicodeBypassValidationFlow`
27
28
*/
28
- class Configuration extends TaintTracking:: Configuration {
29
+ deprecated class Configuration extends TaintTracking:: Configuration {
29
30
Configuration ( ) { this = "UnicodeBypassValidation" }
30
31
31
32
override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowState state ) {
32
- source instanceof RemoteFlowSource and state instanceof PreValidation
33
+ UnicodeBypassValidationConfig :: isSource ( source , state )
33
34
}
34
35
35
36
override predicate isAdditionalTaintStep (
36
37
DataFlow:: Node nodeFrom , DataFlow:: FlowState stateFrom , DataFlow:: Node nodeTo ,
37
38
DataFlow:: FlowState stateTo
39
+ ) {
40
+ UnicodeBypassValidationConfig:: isAdditionalFlowStep ( nodeFrom , stateFrom , nodeTo , stateTo )
41
+ }
42
+
43
+ /* A Unicode Tranformation (Unicode tranformation) is considered a sink when the algorithm used is either NFC or NFKC. */
44
+ override predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowState state ) {
45
+ UnicodeBypassValidationConfig:: isSink ( sink , state )
46
+ }
47
+ }
48
+
49
+ /**
50
+ * A taint-tracking configuration for detecting "Unicode transformation mishandling" vulnerabilities.
51
+ *
52
+ * This configuration uses two flow states, `PreValidation` and `PostValidation`,
53
+ * to track the requirement that a logical validation has been performed before the Unicode Transformation.
54
+ */
55
+ private module UnicodeBypassValidationConfig implements DataFlow:: StateConfigSig {
56
+ class FlowState = DataFlow:: FlowState ;
57
+
58
+ predicate isSource ( DataFlow:: Node source , DataFlow:: FlowState state ) {
59
+ source instanceof RemoteFlowSource and state instanceof PreValidation
60
+ }
61
+
62
+ predicate isAdditionalFlowStep (
63
+ DataFlow:: Node nodeFrom , DataFlow:: FlowState stateFrom , DataFlow:: Node nodeTo ,
64
+ DataFlow:: FlowState stateTo
38
65
) {
39
66
(
40
67
exists ( Escaping escaping | nodeFrom = escaping .getAnInput ( ) and nodeTo = escaping .getOutput ( ) )
@@ -80,7 +107,7 @@ class Configuration extends TaintTracking::Configuration {
80
107
}
81
108
82
109
/* A Unicode Tranformation (Unicode tranformation) is considered a sink when the algorithm used is either NFC or NFKC. */
83
- override predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowState state ) {
110
+ predicate isSink ( DataFlow:: Node sink , DataFlow:: FlowState state ) {
84
111
(
85
112
exists ( DataFlow:: CallNode cn |
86
113
cn .getMethodName ( ) = "unicode_normalize" and
@@ -121,3 +148,8 @@ class Configuration extends TaintTracking::Configuration {
121
148
state instanceof PostValidation
122
149
}
123
150
}
151
+
152
+ /**
153
+ * Taint-tracking configuration for detecting "Unicode transformation mishandling" vulnerabilities.
154
+ */
155
+ module UnicodeBypassValidationFlow = TaintTracking:: GlobalWithState< UnicodeBypassValidationConfig > ;
0 commit comments