{
  "schema": "aidefend-secureflow-metadata-v1",
  "flow_id": "aidefend-research-sf0087-filesystem-mcp-read-move-symlink-races",
  "title": "Filesystem MCP: Symlink Races Escape Read and Move Boundaries",
  "subtitle": "A validated pathname is not necessarily the file the operating system later opens or moves.",
  "summary": "Two Filesystem MCP disclosures show a local process replacing a directory with a symlink after validation. One route reads an outside file by reopening its pathname; another moves an outside file into an allowed directory before reading it. The attacker needs local directory-mutation capability and tool calls, while the server must possess the required filesystem access. Version 2.3.0 is the announced repair.",
  "reviewed": true,
  "import_status": "curated-research",
  "ai_layers": [
    "tool-integrations-mcp"
  ],
  "risk_impact": [
    "data-exfiltration",
    "data-corruption"
  ],
  "affected_components": [
    "read_text_file and head/tail path resolution",
    "move_file same-device rename",
    "allowedDirectories and server OS permissions"
  ],
  "source_research": {
    "provider": "Model Context Protocol maintainers",
    "primary_url": "https://github.com/modelcontextprotocol/servers/security/advisories/GHSA-p9cv-8g75-4xcg",
    "published": "2026-11-11",
    "note": "The read advisory tests npm package 2.1.0 from monorepo tag v2.2.0. The move advisory confirms another v2.2.0 checkout and claims the POSIX import form only. Neither establishes a Windows exploit or a remote-only setup."
  },
  "attack_steps": [
    {
      "id": "read-call",
      "title": "Request an allowed pathname",
      "zhTitle": "請求讀取允許範圍內的路徑",
      "summary": "The client requests a file below a locally mutable allowed directory.",
      "zhSummary": "用戶端要求讀取允許目錄內的檔案；本機程序能變更該目錄。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 0,
        "y": 0
      }
    },
    {
      "id": "read-check",
      "title": "Validate the pathname",
      "zhTitle": "檢查路徑",
      "summary": "The server resolves and accepts the path while it points inside allowedDirectories.",
      "zhSummary": "伺服器解析並接受路徑，此時它仍指向 allowedDirectories 內。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 650,
        "y": 0
      }
    },
    {
      "id": "read-swap",
      "title": "Swap the directory before the open",
      "zhTitle": "在開檔前替換目錄",
      "summary": "A cooperating local process replaces a parent directory with a symlink to the outside target’s directory.",
      "zhSummary": "配合的本機程序把父目錄換成指向外部目標目錄的符號連結。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 1300,
        "y": 0
      }
    },
    {
      "id": "read-outside",
      "title": "Read the newly resolved outside file",
      "zhTitle": "讀取重新解析後的外部檔案",
      "summary": "Opening the pathname again follows the replacement. The Linux two-user test returns a secret the caller cannot read directly.",
      "zhSummary": "再次依路徑名稱開檔時跟隨替換後的連結；Linux 雙使用者測試傳回呼叫者無法直接讀取的秘密值。",
      "tactic": "AML.TA0009",
      "technique": "AML.T0037",
      "layout": {
        "x": 1950,
        "y": 0
      }
    },
    {
      "id": "move-call",
      "title": "Request a same-device move",
      "zhTitle": "請求同一裝置內的搬移",
      "summary": "The source and absent destination initially validate inside the allowed set.",
      "zhSummary": "來源與尚不存在的目的檔案，起初都通過允許範圍檢查。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 0,
        "y": 1300
      }
    },
    {
      "id": "move-swap",
      "title": "Replace the source parent after validation",
      "zhTitle": "在檢查後替換來源的父目錄",
      "summary": "A local racer redirects the source pathname while the destination parent remains pinned.",
      "zhSummary": "刻意配合時機的本機程序改變來源路徑指向，目的父目錄則維持固定。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 650,
        "y": 1300
      }
    },
    {
      "id": "move-import",
      "title": "Move an outside file into the allowed directory",
      "zhTitle": "把外部檔案搬入允許目錄",
      "summary": "Same-device rename resolves the source again and moves the outside file inward, removing its original directory entry.",
      "zhSummary": "同一裝置內的 rename 再次解析來源，把外部檔案搬入，並移除原位置的目錄項目。",
      "tactic": null,
      "technique": null,
      "layout": {
        "x": 1300,
        "y": 1300
      }
    },
    {
      "id": "move-read",
      "title": "Read the imported file through the server",
      "zhTitle": "透過伺服器讀取搬入的檔案",
      "summary": "The imported path now lies inside the allowed directory and can be returned by a read tool.",
      "zhSummary": "搬入後的路徑已位於允許目錄內，因此可由讀取工具傳回。",
      "tactic": "AML.TA0009",
      "technique": "AML.T0037",
      "layout": {
        "x": 1950,
        "y": 1300
      }
    }
  ],
  "threat_refs": [
    {
      "id": "AML.T0037",
      "name": "Data from Local System"
    }
  ],
  "reader_narrative": {
    "pathCount": 2,
    "topologyNote": "Independent read and move routes, each requiring a cooperating local process; neither is a prerequisite for the other.",
    "groups": [
      {
        "id": "read",
        "kind": "path",
        "eyebrow": "Path A",
        "label": "Read after a directory swap",
        "summary": "The later pathname open follows a different object.",
        "stepIds": [
          "read-call",
          "read-check",
          "read-swap",
          "read-outside"
        ]
      },
      {
        "id": "move",
        "kind": "path",
        "eyebrow": "Path B",
        "label": "Import through same-device move",
        "summary": "An outside source is moved inside before the read.",
        "stepIds": [
          "move-call",
          "move-swap",
          "move-import",
          "move-read"
        ]
      }
    ]
  }
}
