subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def search_book(keyword, search_script): """调用PowerShell脚本搜索书籍简介""" try: result = subprocess.run( ['powershell', '-File', search_script, '-Keyword', keyword], capture_output=True, timeout=30- Confidence
- 86% confidence
- Finding
- The code launches PowerShell with a script path supplied from the command line, which means whoever invokes this Python script can cause execution of any local PowerShell script. Although arguments are passed as a list rather than through a shell string, this still exposes arbitrary code execution capability beyond simple metadata lookup and makes the workflow depend on a highly privileged external interpreter.
