class ScriptEngineEval extends DataFlow::Node { ScriptEngineEval() { exists(MethodAccess ma | ma.getCallee().hasName("eval") and ma.getCallee().getDeclaringType().getASupertype*().hasQualifiedName("javax.script", "ScriptEngine") and this.asExpr() = ma.getArgument(0) ) } }
Source
可以将该库所有公有类的字符串类型公有方法参数作为Source点
1 2 3 4 5 6 7 8 9 10 11
class PublicMethodParameter extends DataFlow::Node { PublicMethodParameter() { exists(Method m, Parameter p | m.getDeclaringType().isPublic() and m.isPublic() and p = m.getAParameter() and p.getType().hasName("String") and this.asParameter() = p ) } }
class PublicMethodParameter extends DataFlow::Node { PublicMethodParameter() { exists(Method m, Parameter p | m.getDeclaringType().isPublic() and m.isPublic() and p = m.getAParameter() and p.getType().hasName("String") and this.asParameter() = p ) } }
class ScriptEngineEval extends DataFlow::Node { ScriptEngineEval() { exists(MethodAccess ma | ma.getCallee().hasName("eval") and ma.getCallee().getDeclaringType().getASupertype*().hasQualifiedName("javax.script", "ScriptEngine") and this.asExpr() = ma.getArgument(0) ) } }
class TaintStep extends TaintTracking::AdditionalTaintStep { override predicate step(DataFlow::Node pred, DataFlow::Node succ) { exists(MethodAccess ma, Method m, RefType baseClass | ( ma.getCallee().isAbstract() and pred.asExpr() = ma.getAnArgument() and not m.isAbstract() and succ.asParameter() = m.getAParameter() ) and ma.getCallee().getName() = m.getName() and ( baseClass.isAbstract() and ma.getCallee().getDeclaringType().hasSupertype*(baseClass) and m.getDeclaringType().hasSupertype*(baseClass) ) ) } }
class TaintTrackingConfig extends TaintTracking::Configuration { TaintTrackingConfig() { this = "TaintTrackingConfig" }