subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
script = 'display dialog "%s" with title "%s" %s %s %s\nbutton returned of result' % ( escaped_msg, escaped_title, button_list, default_btn, cancel_btn) try: result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True, timeout=30) return result.stdout.strip() except Exception: return None- Confidence
- 92% confidence
- Finding
- User/clipboard-derived text is embedded into an AppleScript string passed to `osascript`. The code only escapes double quotes and newlines, which is not sufficient for safely embedding arbitrary text in AppleScript source; crafted content can break out of the intended string context and potentially execute unintended AppleScript commands.
