mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Make new threat model kind "reverse-dns"
This commit is contained in:
@@ -119,21 +119,6 @@ private predicate variableStep(Expr tracked, VarAccess sink) {
|
||||
)
|
||||
}
|
||||
|
||||
private class ReverseDnsSource extends RemoteFlowSource {
|
||||
ReverseDnsSource() {
|
||||
// Try not to trigger on `localhost`.
|
||||
exists(MethodCall m | m = this.asExpr() |
|
||||
m.getMethod() instanceof ReverseDnsMethod and
|
||||
not exists(MethodCall l |
|
||||
(variableStep(l, m.getQualifier()) or l = m.getQualifier()) and
|
||||
(l.getMethod().getName() = "getLocalHost" or l.getMethod().getName() = "getLoopbackAddress")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override string getSourceType() { result = "reverse DNS lookup" }
|
||||
}
|
||||
|
||||
private class MessageBodyReaderParameterSource extends RemoteFlowSource {
|
||||
MessageBodyReaderParameterSource() {
|
||||
exists(MessageBodyReaderRead m |
|
||||
@@ -388,6 +373,24 @@ class AndroidJavascriptInterfaceMethodParameter extends RemoteFlowSource {
|
||||
}
|
||||
}
|
||||
|
||||
/** A node with input that may be controlled by a local user. */
|
||||
abstract class ReverseDnsUserInput extends UserInput {
|
||||
override string getThreatModel() { result = "reverse-dns" }
|
||||
}
|
||||
|
||||
private class ReverseDnsSource extends ReverseDnsUserInput {
|
||||
ReverseDnsSource() {
|
||||
// Try not to trigger on `localhost`.
|
||||
exists(MethodCall m | m = this.asExpr() |
|
||||
m.getMethod() instanceof ReverseDnsMethod and
|
||||
not exists(MethodCall l |
|
||||
(variableStep(l, m.getQualifier()) or l = m.getQualifier()) and
|
||||
(l.getMethod().getName() = "getLocalHost" or l.getMethod().getName() = "getLoopbackAddress")
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A data flow source node for an API, which should be considered
|
||||
* supported for a modeling perspective.
|
||||
|
||||
Reference in New Issue
Block a user