Skip to content

Conversation

@guyerez
Copy link
Owner

@guyerez guyerez commented Sep 1, 2025

No description provided.

@guyerez
Copy link
Owner Author

guyerez commented Sep 1, 2025

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
SAST Finding SAST Findings 2 High 2 Medium
Total 2 High 2 Medium

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

Comment on lines +31 to +32
process = subprocess.Popen(
new_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Medium SAST Finding

Unsafe use of subprocess.Popen with shell=True (CWE-78)

More Details

The subprocess.Popen function is being called with the shell=True parameter, which allows the command to be executed through the system's shell. This can be a security risk because it exposes the application to potential command injection attacks. If an attacker can control the input passed to the subprocess.Popen function, they may be able to execute arbitrary commands on the system, leading to data theft, system compromise, or other malicious actions.

To avoid this vulnerability, it is recommended to use subprocess.Popen with shell=False (the default value) and pass the command and its arguments as a list. This way, the command is executed directly without going through the shell, reducing the risk of command injection attacks.

Attribute Value
Impact Medium
Likelihood Medium

Rule ID: WS-I011-PYTHON-00034

Comment on lines +31 to +32
process = subprocess.Popen(
new_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Copy link
Owner Author

Choose a reason for hiding this comment

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

High SAST Finding

Command Injection in Subprocess Calls (CWE-78)

More Details

Detected user input entering a subprocess call unsafely. This could result in a command injection vulnerability. An attacker could use this vulnerability to execute arbitrary commands on the host, which allows them to download malware, scan sensitive data, or run any command they wish on the server. Do not let users choose the command to run. In general, prefer to use Python API versions of system commands. If you must use subprocess, use a dictionary to allowlist a set of commands.

Attribute Value
Impact High
Likelihood Medium

Rule ID: WS-I013-PYTHON-00058

Comment on lines +31 to +32
process = subprocess.Popen(
new_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Medium SAST Finding

Unsafe Subprocess Command Execution (CWE-78)

More Details

This rule detects instances where the Python subprocess module is used to execute external commands without properly sanitizing the input. If the command or arguments can be controlled by an untrusted source, it can lead to command injection vulnerabilities.

Attribute Value
Impact High
Likelihood Low

Rule ID: WS-I013-PYTHON-00140

raise HTTPException(status_code=400, detail="Prevent command injection.")
new_command = request.query_params.get("command")
process = subprocess.Popen(
new_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Copy link
Owner Author

Choose a reason for hiding this comment

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

High SAST Finding

Unsafe Subprocess Command Execution (CWE-78)

More Details

This rule detects instances where user-controlled data is passed to the subprocess module in Python, which could lead to command injection vulnerabilities. Command injection allows an attacker to execute arbitrary system commands on the server, potentially leading to data theft, system compromise, or other malicious actions.

When user input is passed unsanitized to subprocess functions like subprocess.run(), subprocess.call(), or subprocess.Popen(), an attacker could craft input that causes the application to execute unintended system commands. This presents a significant security risk, as the attacker can potentially gain full control over the system.

To avoid this vulnerability, user input should be properly sanitized and validated before being passed to subprocess functions. Alternatively, consider using safer methods that do not involve executing external commands, or implement strict input validation and whitelisting mechanisms.

Attribute Value
Impact High
Likelihood Medium

Rule ID: WS-I013-PYTHON-00193

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.

2 participants