Apache Superset Codebase Exposes High-Severity Command Injection Vulnerability in command_injection.py
A high-severity security flaw has been flagged within the Apache Superset project's codebase, exposing a potential command injection vulnerability. The automated security scanner Bandit identified a critical issue in the file `command_injection.py` at line 22, where a `subprocess.call()` function is executed with `shell=True`. This dangerous configuration, when combined with unsanitized user input, creates a direct pathway for attackers to execute arbitrary commands on the underlying operating system, classified under CWE-78.
The vulnerability is located in a function designed to list directory contents. The code constructs a shell command by directly concatenating the user-controlled variable `path` with the string `"ls -la "`. Using `shell=True` instructs the Python subprocess module to spawn a system shell, which interprets the entire command string. If an attacker can control or influence the `path` parameter, they could inject shell metacharacters (like `;`, `&`, `|`, or `$( )`) to break out of the intended command and run malicious code. The scanner assessed this finding with high confidence, underscoring its immediate risk.
This discovery places significant pressure on the Apache Superset maintainers and any downstream users who may have integrated this code pattern. Unpatched, this flaw could lead to complete server compromise, data exfiltration, or lateral movement within an infrastructure. The issue was automatically generated by a vulnerability remediation system, which references Bandit's official documentation for the B602 rule, providing a clear path for review and mitigation. The presence of such a textbook security anti-pattern in a file explicitly named for the vulnerability it contains adds a layer of operational scrutiny to the project's code review and security practices.