GitHub Security Advisory: GHSA-j98m-w3xp-9f56
Package: excel-mcp-server (PIP)
Severity: CRITICAL (CVSS 9.4)
CWE: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Vulnerable versions: <= 0.1.7
Patched in: 0.1.8

Summary: excel-mcp-server has a Path Traversal issue

Details:
## Summary

A path traversal vulnerability exists in [`excel-mcp-server`](https://github.com/haris-musa/excel-mcp-server) versions up to and including `0.1.7`. When running in SSE or Streamable-HTTP transport mode (the documented way to use this server remotely), an unauthenticated attacker on the network can read, write, and overwrite arbitrary files on the host filesystem by supplying crafted `filepath` arguments to any of the 25 exposed MCP tool handlers.

The server is intended to confine file operations to a directory set by the `EXCEL_FILES_PATH` environment variable. The function responsible for enforcing this boundary — `get_excel_path()` — fails to do so due to two independent flaws: it passes absolute paths through without any check, and it joins relative paths without resolving or validating the result. Combined with zero authentication on the default network-facing transport and a default bind address of `0.0.0.0` (all interfaces), this allows trivial remote exploitation.

---

## Details

| Field | Value |
|-------|-------|
| **Package** | [`excel-mcp-server`](https://pypi.org/project/excel-mcp-server/) (PyPI) |
| **Repository** | https://github.com/haris-musa/excel-mcp-server |
| **Affected versions** | `<= 0.1.7` |
| **Tested version** | `0.1.7` — commit [`de4dc75`](https://github.com/haris-musa/excel-mcp-server/commit/de4dc75f6ba629ccd2e097f[PII_REDACTED]be622e6) |
| **CWE** | [CWE-22](https://cwe.mitre.org/data/definitions/22.html) — Improper Limitation of a Pathname to a Restricted Directory |
| **CVSS 3.1** | **8.2 High** — `AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:H` |
| **Transports affected** | `sse`, `streamable-http` (network-facing) |
| **Authentication required** | **None** |

---

## Vulnerable Code

The root cause is in `src/excel_mcp/server.py`, lines 75–94:

```python
def get_excel_path(filename: str) -> str:
    """Get full path to Excel file."""

    # FLAW 1 — absolute paths bypass the sandbox entirely
    if os.path.isabs(filename):
        return filename                     # line 86: returned as-is

    # In SSE/HTTP mode, EXCEL_FILES_PATH is set
    if EXCEL_FILES_PATH is None:
        raise ValueError(...)

    # FLAW 2 — relative paths joined without boundary validation
    return os.path.join(EXCEL_FILES_PATH, filename)   # line 94: "../" escapes
```

### Why this is exploitable

**Flaw 1 — Absolute path bypass (line 86):**
If the attacker passes `filepath="/etc/shadow"` or `filepath="/home/user/secrets.xlsx"`, the function returns it unchanged. The sandbox directory `EXCEL_FILES_PATH` is never consulted.

**Flaw 2 — Relative traversal (line 94):**
`os.path.join("/srv/sandbox", "../../etc/passwd")` produces `"/srv/sandbox/../../etc/passwd"`, which resolves to `"/etc/passwd"`. No `os.path.realpath()` or `os.path.commonpath()` check is performed, so `../` sequences escape the sandbox.

### Contributing factors that increase severity

1. **Default bind address is `0.0.0.0`** (all interfaces) — `server.py` line 70:
   ``