[RESOLVED] Can't find command injection with this query #8548
CaledoniaProject
started this conversation in
General
Replies: 1 comment 1 reply
-
Your override predicate isSource(DataFlow::Node source) {
exists(Parameter p, Function f |
source.asParameter() = p
and p.hasName("argv")
and f.hasName("main")
)
} Here you're saying that:
Note that, in particular, you're not specifying any relationship between the function and the parameter. I'm guessing you want to say that override predicate isSource(DataFlow::Node source) {
exists(Parameter p, Function f |
source.asParameter() = p and
p.hasName("argv") and
f.hasName("main") and
p.getFunction() = f // <-- I added this line.
)
} Next, let's discuss your override predicate isSink(DataFlow::Node sink) {
exists(FunctionCall fc |
sink.asExpr() = fc and
fc.getTarget().hasQualifiedName("system")
)
} Two things to point out here:
With those changes your override predicate isSink(DataFlow::Node sink) {
exists(FunctionCall fc |
sink.asExpr() = fc.getAnArgument() and
fc.getTarget().hasGlobalOrStdName("system")
)
} and with those definitions of I hope this helps! :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to match detect command injection in this code: bug.cpp.txt
I wrote the following query and quick evaluation in isSource and isSink works fine, but it yields no results:
What was wrong?
Beta Was this translation helpful? Give feedback.
All reactions