[ ⌘K ]
← BACK TO SEARCH

ingpoc/stock_mcp_server

critical

No description

MCP server (purpose undetermined)

purpose: MCP server (purpose undetermined)threat: network exposed
Python4May 20, 2026May 20, 2026GITHUB
5/20/2026
high1 finding
server.py
42MONGODB_URI = "mongodb://localhost:27017"

// Exploitable if MongoDB is accessible from the network (default configuration often binds to localhost only, but misconfiguration could expose it).

The MongoDB connection URI is hardcoded with no authentication, using the default localhost and port. This exposes the database to unauthorized access if the server is network-exposed.

ImpactAn attacker could connect to the MongoDB instance without credentials, potentially reading or modifying stock portfolio data.

FixUse environment variables for the MongoDB URI and enforce authentication. Example: MONGODB_URI = os.environ.get('MONGODB_URI', 'mongodb://localhost:27017') and configure MongoDB with authentication.

high1 finding
server.py
44ALPHA_VANTAGE_API_KEY = os.environ.get("ALPHA_VANTAGE_API_KEY", "")

// Exploitable if an attacker gains access to environment variables or logs.

The Alpha Vantage API key is read from an environment variable but if not set, it defaults to an empty string. The code does not validate the key and proceeds to make API calls, which could leak the empty key in logs or error messages. Additionally, the key is passed as a query parameter to an external API, which is standard but could be exposed in logs or network traffic.

ImpactIf the API key is not set, the server will attempt to call Alpha Vantage without a key, potentially causing errors or exposing the lack of authentication. If the key is set, it is transmitted over HTTPS but could be logged in plaintext.

FixValidate that the API key is present before making requests. Consider using a secrets manager. Ensure logging does not capture the API key.

medium1 finding
server.py
178@server.call_tool()
179async def call_tool_handler(name: str, arguments: Dict[str, Any]):
180    logger.debug(f"Processing call_tool request for tool: {name} with arguments: {arguments}")
181    return await handle_call_tool(name, arguments)

// Exploitable if the MCP server is exposed to untrusted clients over a network.

The MCP server registers tools that can be called by any client without any authentication or authorization checks. The tools likely interact with MongoDB and external APIs, and if exposed over a network, any client could invoke them.

ImpactAn attacker could call any tool to read or modify stock data, or trigger external API calls, leading to data exposure or resource abuse.

FixImplement authentication and authorization for tool calls, especially if the server is network-exposed. Use API keys or OAuth.

medium1 finding
server.py
78async def fetch_alpha_vantage_data(function, symbol, **params):
79    """Fetch data from Alpha Vantage API"""
80    if not ALPHA_VANTAGE_API_KEY:
81        logger.warning("Alpha Vantage API key not set")
82        return None
83        
84    request_params = {
85        "function": function,
86        "symbol": symbol,
87        "apikey": ALPHA_VANTAGE_API_KEY,
88        **params
89    }
90    
91    try:
92        async with aiohttp.ClientSession() as session:
93            async with session.get(ALPHA_VANTAGE_BASE_URL, params=request_params) as response:
94                if response.status == 200:
95                    return await response.json()
96                else:
97                    logger.error(f"Alpha Vantage API error: {response.status}")
98                    return None
99    except Exception as e:
100        logger.error(f"Error fetching Alpha Vantage data: {e}")
101        return None

// Exploitable if an attacker can control the symbol parameter via tool calls.

The 'symbol' parameter is passed directly to the Alpha Vantage API without any validation or sanitization. While the API itself may reject invalid symbols, an attacker could potentially inject special characters or manipulate the request parameters via the **params dict, which is also user-controlled in some tool calls.

ImpactAn attacker could potentially perform SSRF-like attacks by manipulating the symbol or extra parameters, though the base URL is fixed. The risk is limited because the response is JSON and the API key is included, but injection could lead to unexpected API calls or data leakage.

FixValidate the symbol parameter against a whitelist of allowed characters (e.g., alphanumeric and dots). Avoid passing arbitrary **params from user input.

shell.execenv.exposureaws.integration
80
LLM-based
high findings+50
medium findings+30