
A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

A deliberately vulnerable Python MCP server that exposes a read_file tool intended to read files from a safe directory but permits shell command injection.
Vulnerable MCP File Reader Server is cataloged as an MCP server attributed to eliran79. A deliberately vulnerable Python MCP server that exposes a read_file tool intended to read files from a safe directory but permits shell command injection. It is categorized under file systems-docs. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.
Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for Vulnerable MCP File Reader Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
By appending shell commands to the file_name value, such as /tmp/safe/test.txt; whoami, which the server executes due to shell=True.
Avoid shell=True with user input by passing an argument list, quoting input with shlex.quote if needed, and performing proper path validation.
README.md · d9a293be24bd · Fetched 2026-11-13 12:25:12 UTC
Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.
Showing the last retrieved documentation snapshot; check the source for current changes.
This repository demonstrates a critical command injection vulnerability in a Python MCP (Model Context Protocol) server implementation. The vulnerability allows attackers to execute arbitrary shell commands on the host system by manipulating the file path parameter.
The vulnerability exists in the read_file function which is intended to read files from a "safe" directory but contains a dangerous implementation flaw:
command = f"cat {file_name}"
result = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
This code is vulnerable because:
shell=True which invokes a shell to execute the commandfile_name) into the command string without proper sanitizationA simple semantic difference between using quotes around the filename ('file_name') and not using quotes (file_name) exposes the entire system to command execution.
Clone this repository:
git clone https://github.com/Eliran79/Vulnerable-file-reader-server.git
cd Vulnerable-file-reader-server
Install the MCP server:
mcp install main.py
Configure Claude Desktop to use your MCP server by editing ~/.config/claude-desktop/claude_desktop_config.json:
{
"mcpServers": {
"file-reader": {
"command": "/ABSOLUTE/PATH/TO/uv",
"args": [
"--directory",
"/data/git/file_reader_server",
"/usr/bin/uv",
"run,--with,mcp,mcp,run,main.py"
]
}
}
}
Be sure to replace /ABSOLUTE/PATH/TO/uv with the actual path to your uv executable and adjust the directory path if needed.
Start the MCP server in development mode:
mcp dev main.py
In a separate terminal, install and run the MCP inspector:
pip install mcp-inspector
mcp-inspector
Connect to the server in the MCP Inspector GUI:
run --with mcp run main.pyExploit the vulnerability:
/tmp/safe/test.txt; whoami
You should see the contents of test.txt followed by your username, demonstrating successful command execution.
Here are more command injection payloads to try:
/tmp/safe/test.txt; id
/tmp/safe/test.txt; ls -la /etc
/tmp/safe/test.txt; cat /etc/passwd
/tmp/safe/test.txt; echo $(hostname)
/tmp/safe/test.txt; find / -name "*.conf" 2>/dev/null | head -5
To fix this vulnerability, never use shell=True with user-provided input. Instead:
# SECURE: Use a list of arguments instead of shell=True
result = subprocess.check_output(['cat', file_name], shell=False)
# OR, if shell=True is necessary, properly quote the argument:
import shlex
result = subprocess.check_output(f"cat {shlex.quote(file_name)}", shell=True)
# AND perform proper path validation:
import os
safe_dir_resolved = os.path.abspath(SAFE_DIRECTORY)
requested_path_resolved = os.path.abspath(file_name)
if not requested_path_resolved.startswith(safe_dir_resolved):
return f"Error: Access denied. Path traversal attempt detected."
⚠️ FOR EDUCATIONAL PURPOSES ONLY: This implementation contains deliberate security vulnerabilities. Never use this code in a production environment or on any system that contains sensitive information.
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for Vulnerable MCP File Reader Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/vulnerable-file-reader-server)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.
No reviewed package or image identity; download statistics are not listed yet.
Alternative and complementary servers in the same category

A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

Hosted MCP server for tabletop RPG worlds that organizes messy notes and documents into a private store and lets MCP apps search lore, read documents, find characters, and optionally generate character or world pictures.

An MCP server that gives AI assistants scoped file system operations inside a project directory, with read-only reference projects plus git and GitHub tools.