Skip to content

Commit f859fc4

Browse files
committed
C#: Taint members of types used in ASP.NET remote flow source context.
1 parent eced198 commit f859fc4

File tree

1 file changed

+34
-0
lines changed
  • csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources

1 file changed

+34
-0
lines changed

csharp/ql/lib/semmle/code/csharp/security/dataflow/flowsources/Remote.qll

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,40 @@ class AspNetServiceRemoteFlowSource extends AspNetRemoteFlowSource, DataFlow::Pa
115115
override string getSourceType() { result = "ASP.NET web service input" }
116116
}
117117

118+
/**
119+
* Taint members (transitively) on types used in
120+
* 1. Action method parameters.
121+
* 2. WebMethod parameters.
122+
*
123+
* Note, that this also impacts uses of such types in other contexts.
124+
*/
125+
private class AspNetRemoteFlowSourceMember extends TaintTracking::TaintedMember {
126+
AspNetRemoteFlowSourceMember() {
127+
exists(Type t, Type t0 | t = this.getDeclaringType() |
128+
(t = t0 or t = t0.(ArrayType).getElementType()) and
129+
(
130+
t0 = any(AspNetRemoteFlowSourceMember m).getType()
131+
or
132+
t0 = any(ActionMethodParameter p).getType()
133+
or
134+
t0 = any(AspNetServiceRemoteFlowSource source).getType()
135+
)
136+
) and
137+
this.isPublic() and
138+
not this.isStatic() and
139+
(
140+
this =
141+
any(Property p |
142+
p.isAutoImplemented() and
143+
p.getGetter().isPublic() and
144+
p.getSetter().isPublic()
145+
)
146+
or
147+
this = any(Field f | f.isPublic())
148+
)
149+
}
150+
}
151+
118152
/** A data flow source of remote user input (ASP.NET request message). */
119153
class SystemNetHttpRequestMessageRemoteFlowSource extends AspNetRemoteFlowSource, DataFlow::ExprNode
120154
{

0 commit comments

Comments
 (0)