Security: Command Injection via subprocess.Popen in Debug Restart Operator#1090
Open
tomaioo wants to merge 1 commit into
Open
Conversation
The `LUXCORE_OT_debug_restart` operator in `operators/debug.py` uses `subprocess.Popen` with `bpy.app.binary_path` without any sanitization or validation. While `bpy.app.binary_path` is typically set by Blender itself, if this value is somehow manipulated or if the code is modified to accept user input, it could lead to command injection. The operator passes arguments directly to subprocess without using a list properly separated from shell interpretation, though in this case the list format is used correctly. However, the `--python-expr` with inline Python is still a concern for maintainability and potential injection if any part becomes dynamic. Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security: Command Injection via subprocess.Popen in Debug Restart Operator
Problem
Severity:
Medium| File:operators/debug.py:L37The
LUXCORE_OT_debug_restartoperator inoperators/debug.pyusessubprocess.Popenwithbpy.app.binary_pathwithout any sanitization or validation. Whilebpy.app.binary_pathis typically set by Blender itself, if this value is somehow manipulated or if the code is modified to accept user input, it could lead to command injection. The operator passes arguments directly to subprocess without using a list properly separated from shell interpretation, though in this case the list format is used correctly. However, the--python-exprwith inline Python is still a concern for maintainability and potential injection if any part becomes dynamic.Solution
Validate
bpy.app.binary_pathexists and is a legitimate Blender executable before calling subprocess. Consider usingsys.executableinstead if appropriate. Avoid constructing command arguments with string formatting. If user input ever becomes involved, use strict allowlisting.Changes
operators/debug.py(modified)