← MCP server and skill grades

Office-Word-MCP-Server

GongRzhe/Office-Word-MCP-Server

D
Type
MCP server
Scanned
Nov 12, 2026
Version
a3bbbb6d6167
Files read
37

This MCP server lets an AI assistant create, read, format, password-protect, and convert Microsoft Word (.docx) documents on your computer. Its biggest risk is an XML parsing flaw in the footnote tools that lets a crafted Word document pull private files from your machine into the document, alongside unchecked output paths that can overwrite non-Word files if the assistant is tricked.

What it can reach

Files
Creates, reads, edits, copies, encrypts, and decrypts Word (.docx) files and .protection metadata files, lists .docx files in any directory, reads image files to embed in documents, and writes .pdf files anywhere your user account can access.
System
Runs headless LibreOffice (soffice or libreoffice) or Microsoft Word (via docx2pdf) on your machine when converting Word documents to PDF.
Network
Does not use the network by default in stdio mode, but can listen as an HTTP or SSE web server on port 8000 when MCP_TRANSPORT is set.

Findings

2 high1 medium1 low
  1. HighXML external entity (XXE) file disclosure in footnote tools

    word_document_server/core/footnotes.py:337

    Unlike python-docx, the footnote tools unpack .docx archives and parse their internal XML files directly with lxml.etree.fromstring() using default settings, which resolve external XML entities. If you ask the assistant to validate, add, or delete footnotes in a crafted .docx file from a stranger, XML entity declarations inside the document can read arbitrary local text files on your computer (such as SSH keys, .env files, or cloud credentials) and embed their contents into the saved Word document, or freeze the server through entity expansion.

    Fix: Pass a hardened XMLParser(resolve_entities=False, no_network=True, load_dtd=False, dtd_validation=False) to every lxml.etree.fromstring() call in word_document_server/core/footnotes.py, or use defusedxml.

  2. HighFootnote output_filename bypasses .docx extension check and overwrites arbitrary files

    word_document_server/core/footnotes.py

    While other tools force output files to end in .docx or .pdf, the footnote tools (add_footnote_after_text, add_footnote_before_text, add_footnote_enhanced, and delete_footnote_from_document) accept an optional output_filename and write to it without calling ensure_docx_extension(). If prompt injection inside a document or webpage tricks the AI assistant into passing a sensitive file path such as ~/.bashrc, ~/.zshrc, or source code as output_filename, the server overwrites that file with ZIP data (including any uncompressed entries from the source document).

    Fix: Apply ensure_docx_extension(output_filename) and validate the destination path before copying or replacing working_file.

  3. MediumOptional HTTP and SSE server modes bind to 0.0.0.0 without authentication

    word_document_server/main.py:40

    When MCP_TRANSPORT is set to streamable-http or sse, the server listens on 0.0.0.0 (all network interfaces) by default with no password, token, or Origin check. Anyone on the same Wi-Fi/LAN—or anyone on the internet if deployed publicly as shown in RENDER_DEPLOYMENT.md—can call every tool to browse directories, read or overwrite Word documents, and trigger LibreOffice/Word PDF conversions.

    Fix: Default MCP_HOST to 127.0.0.1, validate Origin headers, and require bearer token authentication whenever running streamable-http or sse transports.

  4. LowSetup script installs and configures an unrelated PyPI package name

    setup_mcp.py:337

    This project publishes to PyPI under the name office-word-mcp-server, but the optional setup_mcp.py helper script runs 'pip install word-mcp-server' and writes 'uvx --from word-mcp-server' into mcp-config.json. A user who runs python setup_mcp.py and chooses the recommended PyPI option will install and execute whatever package owns the word-mcp-server name on PyPI rather than this project.

    Fix: Update setup_mcp.py to check, install, and configure office-word-mcp-server instead of word-document-server and word-mcp-server.