mcp-memory-keeper: Arbitrary local file read in context_import via unvalidated filePath
context_import passed the caller-supplied filePath directly to fs.readFileSync with no path confinement. A malicious MCP client — or an LLM agent that is prompt-injected into calling the tool — could point filePath at any file readable by the server process, outside any session or export directory:
*.json credential / service-account file) is parsed and imported into the caller's session, then retrievable verbatim via context_get / context_export./etc/passwd, an SSH key, a .env), JSON.parse throws and V8 includes a snippet of the file's leading bytes in the SyntaxError message, which was returned verbatim to the caller.Both ../ traversal and absolute paths worked — there was no path confinement of any kind.
In a typical MCP deployment the server runs on the developer's machine, so the reachable set includes other users' exported memory sessions, JSON credential/config files, and (in leading-bytes form) .env files, SSH keys, and /etc/passwd. The trigger is a tool argument, so the realistic threat model is an LLM agent prompt-injected into calling context_import, or any MCP client connected to the server.
Fixed in 0.13.0 (PR #36):
<DATA_DIR>/exports, overridable via MEMORY_KEEPER_EXPORT_DIR), resolved with realpathSync. ../ traversal, absolute paths outside the directory, and symlink escapes are all rejected.JSON.parse are separate operations; read/parse failures return a generic message and never echo file bytes (the SyntaxError-message leak is gone). The database-write path is likewise generic.Upgrade to >= 0.13.0. There is no configuration-only workaround for affected versions.
Reported by Zhihao Zhang (@mcfly-zzh).
왜 이 VPI인가 (설명가능 · 실험적)
VPI 산정 기준
| 영향도 | 62.00 |
| 악용 신호(추가 악용신호 없음) | ×1.00 |
| VPI | 62.00 |
VPI 공식 vpi-v1 기준