Files
codeql/javascript/ql/src/Security/CWE-078/IndirectCommandInjection.ql
Asger Feldthaus 83ca4ef6d9 JS: Lower security-severity of queries with speculative threat model
In the CVSS calculator we model this by setting 'Attack Complexity' to
High and 'User Interaction' to Low (as opposed to None).

CVSS vector:
  CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:N/I:H/A:N
2021-10-05 10:10:01 +02:00

29 lines
1006 B
Plaintext

/**
* @name Indirect uncontrolled command line
* @description Forwarding command-line arguments to a child process
* executed within a shell may indirectly introduce
* command-line injection vulnerabilities.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.3
* @precision medium
* @id js/indirect-command-line-injection
* @tags correctness
* security
* external/cwe/cwe-078
* external/cwe/cwe-088
*/
import javascript
import DataFlow::PathGraph
import semmle.javascript.security.dataflow.IndirectCommandInjectionQuery
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, DataFlow::Node highlight
where
cfg.hasFlowPath(source, sink) and
if cfg.isSinkWithHighlight(sink.getNode(), _)
then cfg.isSinkWithHighlight(sink.getNode(), highlight)
else highlight = sink.getNode()
select highlight, source, sink, "This command depends on an unsanitized $@.", source.getNode(),
"command-line argument"