subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
elif args.action == 'set-telegram-token': token = input("Enter Telegram Bot Token: ") import subprocess subprocess.run(['bash', '-c', f'echo "export NEX_VAULT_TELEGRAM_BOT_TOKEN={token}" >> ~/.bashrc']) print("Telegram Bot Token saved. Run 'source ~/.bashrc' to apply.") print(FOOTER)- Confidence
- 99% confidence
- Finding
- This subprocess invocation executes a bash command built with untrusted interactive input. A Telegram token containing shell metacharacters or command substitution can break out of the intended echo statement and trigger arbitrary command execution, while also persisting data into ~/.bashrc. In the context of a local document vault handling sensitive business files, arbitrary local code execution is especially dangerous because it can lead to theft or tampering of stored documents and credentials.
