CRITICAL: Command Injection Vulnerability in setup.sh via eval() Exposes Systems to Full Compromise
A critical command injection vulnerability has been identified in the `setup.sh` installation script, allowing for remote code execution (RCE) and full system compromise. The flaw is rooted in line 127, where user-supplied values are passed directly to the `eval()` function without sanitization. This design flaw enables an attacker to inject and execute arbitrary shell commands with the privileges of the user running the installation, effectively handing over control of the system.
The vulnerability is triggered during the standard installation process. A proof-of-concept demonstrates that by setting an environment variable like `KARAKOS_DISCORD_TOKEN` to a malicious payload (e.g., `'; rm -rf / #`), the subsequent `eval` command will execute the injected code. This is not a theoretical risk; it is a direct path for an attacker to execute commands, delete files, or establish persistence on the host machine from the moment of installation.
The impact is severe and unambiguous: remote code execution leading to full system compromise. The recommended fix is to replace the vulnerable `eval "$var_name='$value'"` line with a secure alternative using `declare`, such as `declare "$var_name=$value"`. This vulnerability is classified as CRITICAL, as it provides a straightforward attack vector during a routine administrative task, posing an immediate risk to any system where the software is installed.