Skip to content

Commit 147784a

Browse files
authored
Create test.ql
1 parent 7257b4a commit 147784a

File tree

1 file changed

+25
-0
lines changed
  • powershell/ql/src/queries/security/cwe-078

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @name Uncontrolled command line
3+
* @description Using externally controlled strings in a command line may allow a malicious
4+
* user to change the meaning of the command.
5+
* @kind path-problem
6+
* @problem.severity error
7+
* @security-severity 9.8
8+
* @precision high
9+
* @id powershell/command-injection-test
10+
* @tags correctness
11+
* security
12+
* external/cwe/cwe-078
13+
* external/cwe/cwe-088
14+
*/
15+
16+
import powershell
17+
import semmle.code.powershell.security.CommandInjectionQuery
18+
import CommandInjectionFlow::PathGraph
19+
20+
from CommandInjectionFlow::PathNode source, CommandInjectionFlow::PathNode sink, Source sourceNode
21+
where
22+
CommandInjetionFlow::flowPath(source, sink) and
23+
sourceNode = source.getNode()
24+
select sink.getNode(), source, sink, "This command depends on a $@.", sourceNode,
25+
sourceNode.getSourceType()

0 commit comments

Comments
 (0)