-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathFlaskDebug.ql
More file actions
25 lines (23 loc) · 832 Bytes
/
FlaskDebug.ql
File metadata and controls
25 lines (23 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @name Flask app is run in debug mode
* @description Running a Flask app in debug mode may allow an attacker to run arbitrary code through the Werkzeug debugger.
* @kind problem
* @problem.severity error
* @security-severity 7.5
* @precision high
* @id py/flask-debug
* @tags security
* external/cwe/cwe-215
* external/cwe/cwe-489
*/
import python
import semmle.python.dataflow.new.DataFlow
import semmle.python.ApiGraphs
import semmle.python.frameworks.Flask
from API::CallNode call
where
call = Flask::FlaskApp::instance().getMember("run").getACall() and
call.getParameter(2, "debug").getAValueReachingSink().asExpr().(ImmutableLiteral).booleanValue() =
true
select call,
"A Flask app appears to be run in debug mode. This may allow an attacker to run arbitrary code through the debugger."