-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathCommandInjection.ql
More file actions
29 lines (25 loc) · 1 KB
/
CommandInjection.ql
File metadata and controls
29 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* @name Command built from user-controlled sources
* @description Building a system command from user-controlled sources is vulnerable to insertion of
* malicious code by the user.
* @kind path-problem
* @problem.severity error
* @security-severity 9.8
* @precision high
* @id go/command-injection
* @tags security
* external/cwe/cwe-078
*/
import go
import semmle.go.security.CommandInjection
module Flow =
DataFlow::MergePathGraph<CommandInjection::Flow::PathNode,
CommandInjection::DoubleDashSanitizingFlow::PathNode, CommandInjection::Flow::PathGraph,
CommandInjection::DoubleDashSanitizingFlow::PathGraph>;
import Flow::PathGraph
from Flow::PathNode source, Flow::PathNode sink
where
CommandInjection::Flow::flowPath(source.asPathNode1(), sink.asPathNode1()) or
CommandInjection::DoubleDashSanitizingFlow::flowPath(source.asPathNode2(), sink.asPathNode2())
select sink.getNode(), source, sink, "This command depends on a $@.", source.getNode(),
"user-provided value"