github / github/codeql

General issue: Missing vulnerability reports due to incomplete self variable reference relationships in Python classes

Abierto
#18,374 4 comentarios 1 reacción 0 asignados Ver en GitHub
Python question
Lenguaje dominante
CodeQL
Estrellas
10.1k
Forks
2.1k
Merge medio
2 d 15 h
PR fusionados (30 d)
141

Descripción

code:
```
import os
from flask import Flask, request

app = Flask(__name__)

class CCC:
def update(self, **kwargs):
os.system(kwargs["mode"])

class test:
def __init__(self):
self.A = CCC()

@app.route('/execute')
def execute_command(self):
cmd = request.args.get('cmd')
self.A.update(mode=cmd, file="a")
return "Command executed"
```
ql:
```
/**
* @name Uncontrolled command line
* @description Using externally controlled strings in a command line may allow a malicious
* user to change the meaning of the command.
* @kind path-problem
* @problem.severity error
* @security-severity 9.8
* @sub-severity high
* @precision high
* @id py/command-line-injection
* @tags correctness
* security
* external/cwe/cwe-078
* external/cwe/cwe-088
*/

import python
import semmle.python.security.dataflow.CommandInjectionQuery
import CommandInjectionFlow::PathGraph

from CommandInjectionFlow::PathNode source, CommandInjectionFlow::PathNode sink
where CommandInjectionFlow::flowPath(source, sink)
select sink.getNode(), source, sink, "This command line depends on a $@.", source.getNode(),
"user-provided value"
```
this ql file can not find bug!!!!???
why???
I hope you can help me, thank you.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.