mirror of
https://github.com/github/codeql.git
synced 2026-01-23 19:32:59 +01:00
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
31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
/**
|
|
* @name Shell command built from environment values
|
|
* @description Building a shell command string with values from the enclosing
|
|
* environment may cause subtle bugs or vulnerabilities.
|
|
* @kind path-problem
|
|
* @problem.severity warning
|
|
* @security-severity 6.3
|
|
* @precision high
|
|
* @id js/shell-command-injection-from-environment
|
|
* @tags correctness
|
|
* security
|
|
* external/cwe/cwe-078
|
|
* external/cwe/cwe-088
|
|
*/
|
|
|
|
import javascript
|
|
import DataFlow::PathGraph
|
|
import semmle.javascript.security.dataflow.ShellCommandInjectionFromEnvironmentQuery
|
|
|
|
from
|
|
Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink, DataFlow::Node highlight,
|
|
Source sourceNode
|
|
where
|
|
sourceNode = source.getNode() and
|
|
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 shell command depends on an uncontrolled $@.", sourceNode,
|
|
sourceNode.getSourceType()
|