Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Create example.py #11

wants to merge 1 commit into from

Conversation

try-panwiac
Copy link
Owner

No description provided.

Copy link

@prisma-cloud-devsecops prisma-cloud-devsecops bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prisma Cloud has found errors in this PR ⬇️

@app.route("/tainted7/<something>")
def test_sources_7(something):

os.system(request.remote_addr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM  Unsanitized input from data from a remote resource flows into os.system
    File: example.py | Checkov ID: CKV3_SAST_48

Description

CWE: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
OWASP: A03:2021-Injection

This policy detects when unsanitized input from a remote resource is used as a command in os.system in Python code, which can lead to a Command Injection vulnerability.

Vulnerable code example:

import os
data = request.args.get("input")
os.system(data)

The above code is vulnerable because it takes user input from the request.args.get() function and directly passes it to os.system, without any sanitization or validation. An attacker can manipulate the input to execute arbitrary commands on the underlying system.

import os
from flask import Flask, request
import bleach
app = Flask(__name__)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HIGH  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:

  1. Unauthorized actions performed on behalf of an authenticated user.
  2. Data breaches.
  3. Account hijacking.
  4. Exploitation of the trust a user has with a specific site.

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:

# Disabling CSRF protection in Flask-WTF
class MyForm(flask_wtf.FlaskForm):
    class Meta:
        csrf = False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant