Shell injection via subprocess.call(shell=True) with user-controlled path and loginServer in start_game() #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
start_game()builds a shell command string by concatenatingpath,exe,window_mode,width,height, a language code, andloginServer, then passes it tosubprocess.call(..., shell=True). Thepathvariable is derived frombase_path, which is read directly from the user-editable4lbion.jsonconfig file. Any shell metacharacters in that value (;,&&,|, backticks, etc.) are interpreted by the shell.Location
4lbion.py, lines 325–402 (base_path = get_json_data("basePath"),subprocess.call(... shell=True))Risk
If an attacker can modify
4lbion.json(e.g., via a malicious script, social engineering, or a path traversal in the updater), they can inject arbitrary shell commands that execute with the user's privileges when the Play button is pressed. Even without an external attacker,shell=Truewith string concatenation is considered an unsafe pattern and can cause unexpected behaviour if the game path contains spaces or special characters.Suggested fix direction
Replace
subprocess.call(shell=True, ...)with a list-based invocation:subprocess.call([path + "/" + exe, window_mode, ...]). This completely avoids shell interpretation. On macOS theopenprefix should be handled as a separate list entry.Severity
critical
Found by
Automated audit by Claude Code