os.system() or os exec-family call
High
- Category
- Dangerous Code Execution
- Content
@app.route('/ping') def ping(): host = request.args.get('host', 'localhost') os.system("ping -c 1 " + host) # ❌ eval 注入 @app.route('/calc')- Confidence
- 99% confidence
- Finding
- The /ping route concatenates untrusted user input into a shell command and executes it with os.system(), creating a classic command injection vulnerability. In this file's context, the code is explicitly presented as intentionally unsafe example code, which lowers the likelihood of malicious intent but not the technical severity if the example is run as a real Flask service.
