Skip to content

Commit 8c9ccab

Browse files
committed
Autoformat
1 parent 72d9d47 commit 8c9ccab

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

java/ql/src/experimental/Security/CWE/CWE-078/CommandInjectionRuntimeExec.ql

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,29 @@
1111
* external/cwe/cwe-078
1212
*/
1313

14-
1514
import DataFlow::PathGraph
1615
import CommandInjectionRuntimeExec
1716

18-
class RemoteSource extends Source { RemoteSource() { this instanceof RemoteFlowSource } }
17+
class RemoteSource extends Source {
18+
RemoteSource() { this instanceof RemoteFlowSource }
19+
}
1920

20-
from DataFlow::PathNode source, DataFlow::PathNode sink, ExecTaintConfiguration2 conf, MethodAccess call, DataFlow::Node sourceCmd, DataFlow::Node sinkCmd, ExecTaintConfiguration confCmd
21-
where call.getMethod() instanceof RuntimeExecMethod
22-
// this is a command-accepting call to exec, e.g. rt.exec(new String[]{"/bin/sh", ...})
23-
and (
24-
confCmd.hasFlow(sourceCmd, sinkCmd)
25-
and sinkCmd.asExpr() = call.getArgument(0)
26-
)
27-
// it is tainted by untrusted user input
28-
and (
29-
conf.hasFlow(source.getNode(), sink.getNode())
30-
and sink.getNode().asExpr() = call.getArgument(0)
31-
)
32-
select sink, source, sink, "Call to dangerous java.lang.Runtime.exec() with command '$@' with arg from untrusted input '$@'",
33-
sourceCmd, sourceCmd.toString(),
34-
source.getNode(), source.toString()
21+
from
22+
DataFlow::PathNode source, DataFlow::PathNode sink, ExecTaintConfiguration2 conf,
23+
MethodAccess call, DataFlow::Node sourceCmd, DataFlow::Node sinkCmd,
24+
ExecTaintConfiguration confCmd
25+
where
26+
call.getMethod() instanceof RuntimeExecMethod and
27+
// this is a command-accepting call to exec, e.g. rt.exec(new String[]{"/bin/sh", ...})
28+
(
29+
confCmd.hasFlow(sourceCmd, sinkCmd) and
30+
sinkCmd.asExpr() = call.getArgument(0)
31+
) and
32+
// it is tainted by untrusted user input
33+
(
34+
conf.hasFlow(source.getNode(), sink.getNode()) and
35+
sink.getNode().asExpr() = call.getArgument(0)
36+
)
37+
select sink, source, sink,
38+
"Call to dangerous java.lang.Runtime.exec() with command '$@' with arg from untrusted input '$@'",
39+
sourceCmd, sourceCmd.toString(), source.getNode(), source.toString()

0 commit comments

Comments
 (0)