Skip to content

Commit fa90655

Browse files
committed
Partial revert: only introduce inferred taint edges from callsite-crossing value edges if an original taint edge targets the *start* of the value edge.
Previously we would also take a taint edge targeting a result and a value-preserving edge propagating another argument to the result to imply a taint edge targeting that argument.
1 parent ce63809 commit fa90655

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

java/ql/src/semmle/code/java/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,19 @@ private predicate localAdditionalBasicTaintStep(DataFlow::Node src, DataFlow::No
6767
* Holds if an additional step from `src` to `sink` through a call can be inferred from the
6868
* combination of a value-preserving step providing an alias between an input and the output
6969
* and a taint step from `src` to one the aliased nodes. For example, if we know that `f(a, b)` returns
70-
* the exact value of `a` and also propagates taint from `b` to its result, then we also know that
71-
* `a` is tainted after `f` completes, and vice versa.
70+
* the exact value of `a` and also propagates taint from `b` to `a`, then we also know that
71+
* the return value is tainted after `f` completes.
7272
*/
7373
private predicate composedValueAndTaintModelStep(ArgumentNode src, DataFlow::Node sink) {
7474
exists(Call call, ArgumentNode valueSource, DataFlow::PostUpdateNode valueSourcePost |
7575
src.argumentOf(call, _) and
7676
valueSource.argumentOf(call, _) and
7777
src != valueSource and
7878
valueSourcePost.getPreUpdateNode() = valueSource and
79+
// in-x -value-> out-y and in-z -taint-> in-x ==> in-z -taint-> out-y
80+
localAdditionalBasicTaintStep(src, valueSourcePost) and
7981
DataFlow::localFlowStep(valueSource, DataFlow::exprNode(call)) and
80-
(
81-
// in-x -value-> out-y and in-z -taint-> out-y ==> in-z -taint-> in-x
82-
localAdditionalBasicTaintStep(src, DataFlow::exprNode(call)) and
83-
sink = valueSourcePost
84-
or
85-
// in-x -value-> out-y and in-z -taint-> in-x ==> in-z -taint-> out-y
86-
localAdditionalBasicTaintStep(src, valueSourcePost) and
87-
sink = DataFlow::exprNode(call)
88-
)
82+
sink = DataFlow::exprNode(call)
8983
)
9084
}
9185

0 commit comments

Comments
 (0)