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 @@
## 2024-05-30 - Command Injection in Windows File Launch
**Vulnerability:** \`subprocess.call(['start', filename], shell=True)\` was used to open files on Windows, allowing arbitrary command execution if the filename contained shell metacharacters like \`&\` or \`^\`.
**Learning:** \`os.path.isfile()\` verification is insufficient to prevent command injection because Windows filenames can legally contain shell metacharacters.
**Prevention:** Use \`os.startfile()\` which executes the file natively without invoking \`cmd.exe\`.
3 changes: 2 additions & 1 deletion libs/utility_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def _open_resource_file(self, filename):
try:
if os.path.isfile(filename):
if platform.system() == "Windows":
subprocess.call(['start', filename], shell=True)
# πŸ›‘οΈ Sentinel: Prevent command injection by avoiding shell=True for file execution
os.startfile(filename)
elif platform.system() == "Darwin":
subprocess.call(['open', filename])
elif platform.system() == "Linux":
Expand Down
Loading