Skip to content

Commit 71e958e

Browse files
committed
C#: Add taint-tracking steps through conversion operator calls
1 parent acb069f commit 71e958e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/internal/TaintTrackingPrivate.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ private class LocalTaintExprStepConfiguration extends ControlFlowReachabilityCon
113113
scope = e2 and
114114
isSuccessor = true
115115
)
116+
or
117+
e2 = any(OperatorCall oc |
118+
oc.getTarget() instanceof ConversionOperator and
119+
e1 = oc.getAnArgument() and
120+
isSuccessor = true
121+
)
116122
)
117123
}
118124

csharp/ql/test/library-tests/dataflow/local/TaintTracking.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
| LocalDataFlow.cs:430:23:430:28 | access to local variable sink72 |
6565
| LocalDataFlow.cs:445:15:445:20 | access to local variable sink73 |
6666
| LocalDataFlow.cs:446:15:446:20 | access to local variable sink74 |
67+
| LocalDataFlow.cs:449:15:449:20 | access to local variable sink75 |
68+
| LocalDataFlow.cs:452:15:452:20 | access to local variable sink76 |
6769
| LocalDataFlow.cs:478:15:478:21 | access to parameter tainted |
6870
| SSA.cs:9:15:9:22 | access to local variable ssaSink0 |
6971
| SSA.cs:25:15:25:22 | access to local variable ssaSink1 |

csharp/ql/test/library-tests/dataflow/local/TaintTrackingStep.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,11 @@
727727
| LocalDataFlow.cs:446:15:446:20 | [post] access to local variable sink74 | LocalDataFlow.cs:448:32:448:37 | access to local variable sink74 |
728728
| LocalDataFlow.cs:446:15:446:20 | access to local variable sink74 | LocalDataFlow.cs:448:32:448:37 | access to local variable sink74 |
729729
| LocalDataFlow.cs:448:23:448:37 | SSA def(sink75) | LocalDataFlow.cs:449:15:449:20 | access to local variable sink75 |
730+
| LocalDataFlow.cs:448:32:448:37 | access to local variable sink74 | LocalDataFlow.cs:448:32:448:37 | call to operator implicit conversion |
730731
| LocalDataFlow.cs:448:32:448:37 | call to operator implicit conversion | LocalDataFlow.cs:448:23:448:37 | SSA def(sink75) |
731732
| LocalDataFlow.cs:451:23:451:52 | SSA def(sink76) | LocalDataFlow.cs:452:15:452:20 | access to local variable sink76 |
732733
| LocalDataFlow.cs:451:32:451:52 | call to operator implicit conversion | LocalDataFlow.cs:451:23:451:52 | SSA def(sink76) |
734+
| LocalDataFlow.cs:451:47:451:52 | access to local variable sink66 | LocalDataFlow.cs:451:32:451:52 | call to operator implicit conversion |
733735
| LocalDataFlow.cs:470:28:470:30 | this | LocalDataFlow.cs:470:41:470:45 | this access |
734736
| LocalDataFlow.cs:470:50:470:52 | this | LocalDataFlow.cs:470:56:470:60 | this access |
735737
| LocalDataFlow.cs:470:50:470:52 | value | LocalDataFlow.cs:470:50:470:52 | value |

0 commit comments

Comments
 (0)