Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2025-03-05 - Windows Command Injection via subprocess.call
**Vulnerability:** Command Injection vulnerability exists when using `subprocess.call(['start', filename], shell=True)` because `shell=True` on Windows allows attackers to execute arbitrary shell commands if the filename contains shell metacharacters (e.g. `&` or `^`), even if it passes `os.path.isfile()`.
**Learning:** Checking if a file exists (`os.path.isfile()`) is insufficient to prevent command injection on Windows when `shell=True` is used, because legal Windows filenames can contain metacharacters that the shell interprets.
**Prevention:** Always prefer `os.startfile(filename)` over `subprocess.call` with `shell=True` for opening files on Windows.
2 changes: 1 addition & 1 deletion libs/utility_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _open_resource_file(self, filename):
try:
if os.path.isfile(filename):
if platform.system() == "Windows":
subprocess.call(['start', filename], shell=True)
os.startfile(filename)
elif platform.system() == "Darwin":
subprocess.call(['open', filename])
elif platform.system() == "Linux":
Expand Down
Loading