-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create example.py #11
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
from flask import Flask, request | ||
import bleach | ||
app = Flask(__name__) | ||
|
||
# curl -X GET "http://localhost:5000/tainted7/touch%20HELLO" | ||
@app.route("/tainted7/<something>") | ||
def test_sources_7(something): | ||
|
||
os.system(request.remote_addr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsanitized input from data from a remote resource flows into os.system
|
||
|
||
return "foo" | ||
|
||
@app.route("/sanitized/<something>") | ||
def test_sources_7(something): | ||
data = flask.request.args.get("key") | ||
sanitized_data = bleach.clean(data) | ||
os.system(sanitized_data) | ||
|
||
return "bar" | ||
|
||
if __name__ == "__main__": | ||
app.run(debug=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSRF protections disabled
File: example.py | Checkov ID: CKV3_SAST_56
Description
CWE:
CWE-352: Cross-Site Request Forgery (CSRF)
OWASP:
A01:2021-Broken Access Control
Cross-Site Request Forgery (CSRF) is an attack that forces a victim to execute unwanted actions on a web application they are authenticated with. By disabling CSRF protections, applications expose themselves to a serious security risk. This policy has identified instances where CSRF protections are disabled or not correctly implemented.
When CSRF protections are disabled, it can lead to:
In the analyzed codebase, instances were detected where the CSRF protections were explicitly turned off. Such configurations increase the application's vulnerability to CSRF attacks.
For example, avoiding practices like: