mirror of
https://github.com/hohn/codeql-dataflow-sql-injection.git
synced 2025-12-16 18:23:05 +01:00
sql injection: use post-update nodes for function return values
This commit is contained in:
committed by
=Michael Hohn
parent
5bce3ae696
commit
ba3cfcb010
@@ -17,7 +17,7 @@ class SqliFlowConfig extends TaintTracking::Configuration {
|
|||||||
// count = read(STDIN_FILENO, buf, BUFSIZE);
|
// count = read(STDIN_FILENO, buf, BUFSIZE);
|
||||||
exists(FunctionCall read |
|
exists(FunctionCall read |
|
||||||
read.getTarget().getName() = "read" and
|
read.getTarget().getName() = "read" and
|
||||||
read.getArgument(1) = source.asExpr()
|
read.getArgument(1) = source.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ class SqliFlowConfig extends TaintTracking::Configuration {
|
|||||||
// #endif
|
// #endif
|
||||||
exists(FunctionCall printf |
|
exists(FunctionCall printf |
|
||||||
printf.getTarget().getName().matches("%snprintf%") and
|
printf.getTarget().getName().matches("%snprintf%") and
|
||||||
printf.getArgument(0) = out.asExpr() and
|
printf.getArgument(0) = out.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr() and
|
||||||
// very specific: shifted index for macro. We can generalize this to consider
|
// very specific: shifted index for macro. We can generalize this to consider
|
||||||
// all trailing arguments as sources.
|
// all trailing arguments as sources.
|
||||||
printf.getArgument(6) = into.asExpr()
|
printf.getArgument(6) = into.asExpr()
|
||||||
|
|||||||
Reference in New Issue
Block a user