General issue: Missing vulnerability reports due to incomplete self variable reference relationships in Python classes
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 141
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Riproduci l'esempio Python/Flask fornito con la query CodeQL inclusa, quindi analizza il comportamento del flusso di dati per la chiamata self.A.update(...) e il sink os.system. Il lavoro è completato quando la query segnala il percorso di command injection in questo esempio; nell'issue non viene indicato alcun file del repository né alcun test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- flask, python
- Ambito
- security
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100