Summary
The build_output_path() function in utils.py accepts a user-controlled output_directory parameter without validating that the resulting path stays within the intended base directory. An attacker can write arbitrary files to any writable location on the filesystem.
Details
File: minimax_mcp/utils.py, function build_output_path()
if output_directory is None:
output_path = Path(os.path.expanduser(base_path))
elif not os.path.isabs(os.path.expanduser(output_directory)):
output_path = Path(os.path.expanduser(base_path)) / Path(output_directory)
else:
output_path = Path(os.path.expanduser(output_directory)) # No confinement!
Impact
An attacker can write arbitrary files to any writable location (overwrite cron jobs, plant backdoors, write SSH keys).
Suggested Fix
output_path = Path(os.path.expanduser(output_directory)).resolve()
base_resolved = Path(os.path.expanduser(base_path)).resolve()
if not str(output_path).startswith(str(base_resolved)):
raise MinimaxMcpError("Output path escapes base directory")
Reported by Correctover Security Research (https://correctover.com)
Summary
The
build_output_path()function inutils.pyaccepts a user-controlledoutput_directoryparameter without validating that the resulting path stays within the intended base directory. An attacker can write arbitrary files to any writable location on the filesystem.Details
File:
minimax_mcp/utils.py, functionbuild_output_path()Impact
An attacker can write arbitrary files to any writable location (overwrite cron jobs, plant backdoors, write SSH keys).
Suggested Fix
Reported by Correctover Security Research (https://correctover.com)