Vulnerable-file-reader-server

Vulnerable-file-reader-server

3.2

If you are the rightful owner of Vulnerable-file-reader-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This repository demonstrates a critical command injection vulnerability in a Python MCP server implementation.

The Model Context Protocol (MCP) server in this repository is designed to read files from a specified directory. However, it contains a command injection vulnerability in the `read_file` function. This vulnerability arises from the use of `shell=True` in the `subprocess.check_output` call, which allows attackers to execute arbitrary shell commands by manipulating the file path parameter. The server is intended for educational purposes to highlight the risks associated with improper input handling and command execution in Python applications. Users are advised to never use this code in production environments.

Features

  • Demonstrates command injection vulnerability
  • Educational tool for understanding security flaws
  • Includes setup and exploitation instructions
  • Provides examples of command injection payloads
  • Offers guidance on secure coding practices