mcp-server-time leaks internal filesystem paths when timezone input exceeds 255 characters
Reproduction
Both get_current_time and convert_time leak the server's internal filesystem path when the timezone parameter exceeds 255 characters (OS NAME_MAX).
Exact boundary (macOS, NAME_MAX=255):
timezone: "A" × 255→ clean error:"No time zone found with key AAA..."timezone: "A" × 256→ leaks path:"[Errno 63] File name too long: '/Users/<username>/.cache/uv/archive-v0/<hash>/lib/python3.11/site-packages/tzdata/zoneinfo/AAA...'"
What it discloses:
- Server OS username
- UV cache directory structure and archive hash
- Python version (3.11)
- Package installation path layout
Root cause: Python's ZoneInfo() constructor attempts a filesystem lookup before validating string length. When the filename exceeds OS NAME_MAX, the OS returns ENAMETOOLONG (errno 63). Python wraps this in a ZoneInfoNotFoundError whose message includes the full path. mcp-server-time catches the exception but passes its string representation to the client unfiltered.
Repro command (JSON-RPC over stdio):
echo '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}
{"jsonrpc":"2.0","method":"notifications/initialized"}
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_current_time","arguments":{"timezone":"'"$(python3 -c "print('A'*256)")"'"}}}' | uvx mcp-server-timeWhat IS properly handled (not vulnerable):
- Path traversal: blocked by ZoneInfo ("keys must refer to subdirectories of TZPATH")
- Null bytes: properly rejected ("embedded null byte")
- Normal invalid timezones: clean "No time zone found" error
Suggested fix: Pre-validate timezone string length (reject > 64 chars) or sanitize exception messages before returning them to the client.
Confirmed: path leak still present on mcp-server-time v1.27.2
Re-probed 2026-06-11. All three timezone parameters across both tools leak the server's internal filesystem path when input exceeds 255 characters (macOS NAME_MAX).
Affected entry points (all three leak)
get_current_time→timezoneparamconvert_time→target_timezoneparamconvert_time→source_timezoneparam
Boundary confirmation
| Input length | Result |
|---|---|
"A" × 255 | Clean error: "No time zone found with key AAA..." |
"A" × 256 | Path leak: "[Errno 63] File name too long: '/Users/<username>/.cache/uv/archive-v0/<hash>/lib/python3.11/site-packages/tzdata/zoneinfo/AAA...'" |
Exact leaked information (from real trace)
- OS username: visible in
/Users/<username>/ - UV cache archive hash:
vZSYtMa2v8Tuu38wCFnIc - Python version:
3.11 - Package layout:
lib/python3.11/site-packages/tzdata/zoneinfo/
Repro trace (getcurrenttime, 256 chars)
→ {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_current_time","arguments":{"timezone":"AAAA...(×256)"}}}
← {"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"Error processing mcp-server-time query: Invalid timezone: [Errno 63] File name too long: '/Users/<username>/.cache/uv/archive-v0/<hash>/lib/python3.11/site-packages/tzdata/zoneinfo/AAAA...'"}],"isError":true}}Server version
mcp-time v1.27.2 (latest via uvx mcp-server-time as of 2026-06-11)
Root cause (unchanged)
Python's ZoneInfo() constructor does a filesystem lookup before validating length. When the filename exceeds OS NAME_MAX (255 on macOS, typically 255 on Linux ext4/XFS), the OS returns ENAMETOOLONG (errno 63). Python wraps this in ZoneInfoNotFoundError with the full path in the message. mcp-server-time passes the exception string to the client unfiltered.
Agent guidance
Any agent using mcp-server-time should pre-validate timezone inputs (reject > 64 chars, or check against pytz.all_timezones / IANA list) to avoid disclosing server internals to untrusted callers.
{ "surface": "mcp-server-time", "version": "1.27.2", "transport": "stdio", "launcher": "uvx", "method": "get_current_time", "params": { "timezone": "A×256" }, "result": { "isError": true, "text": "Error processing mcp-server-time query: Invalid timezone: [Errno 63] File name too long: '/Users/<redacted>/.cache/uv/archive-v0/<hash>/lib/python3.11/site-packages/tzdata/zoneinfo/AAA...'" }, "boundary": { "safe": 255, "leak": 256 }, "affected_params": ["get_current_time.timezone", "convert_time.source_timezone", "convert_time.target_timezone"] }