{"answers":{"affected":"2 open source packages ship an affected version, including @evomap/evolver.","exploited":"There is no known exploitation of GHSA-cfcj-hqpf-hccf in the wild and no public exploit code.","fix":"Upgrade @evomap/evolver to 1.70.0-beta.5 or later.","what":"GHSA-cfcj-hqpf-hccf is a path traversal vulnerability in @evomap/evolver, published on 5 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-cfcj-hqpf-hccf and fix it if it is affected.\n\nWhat it is: GHSA-cfcj-hqpf-hccf is a path traversal vulnerability in @evomap/evolver, published on 5 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-cfcj-hqpf-hccf in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @evomap/evolver (npm): affected all versions; fixed in 1.70.0-beta.5\n- @evomap/evolver (npm): affected all versions; fixed in 1.70.0-beta.5\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-cfcj-hqpf-hccf/ (Markdown: https://insights.sbomify.com/GHSA-cfcj-hqpf-hccf/index.md)","id":"GHSA-cfcj-hqpf-hccf","markdown":"https://insights.sbomify.com/GHSA-cfcj-hqpf-hccf/index.md","name":"GHSA-cfcj-hqpf-hccf","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"npm package","requires_auth":"none","summary":"A malicious Hub can overwrite project files via path traversal in evolver fetch, leading to remote code execution on the next invocation.","user_interaction":"required","vuln_class":"path_traversal"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Summary\n\nThe `evolver fetch` subcommand in `index.js` writes Hub-supplied `bundled_files[]` into a directory derived from a Hub-supplied `skill_id`. When `--out` is not used, the path-sanitizing regex permits `.` characters, allowing a `skill_id` of `..` to escape the `skills/` subdirectory and resolve to the user's current working directory. Combined with the file-extension allow-list (which includes `.js`/`.json`/`.sh`/`.py`/`.md`), this lets a malicious Hub overwrite the victim's `index.js`, `package.json`, or other files in cwd, achieving remote code execution on the next invocation of the evolver.\n\n## Details\n\nThe vulnerable code is in the `fetch` command handler:\n\n```js\n// index.js:847-873\nconst data = await resp.json();\nconst outFlag = args.find(a =\u003e typeof a === 'string' \u0026\u0026 a.startsWith('--out='));\nconst safeId = String(data.skill_id || skillId).replace(/[^a-zA-Z0-9_\\-\\.]/g, '_');\nlet outDir;\nif (outFlag) {\n  const rawOut = outFlag.slice('--out='.length);\n  // ...\n  const resolvedOut = path.resolve(process.cwd(), rawOut);\n  const cwd = path.resolve(process.cwd());\n  const rel = path.relative(cwd, resolvedOut);\n  if (rel.startsWith('..') || path.isAbsolute(rel)) {     // \u003c-- traversal check exists for --out\n    console.error('[fetch] --out= must resolve to a path inside the current working directory');\n    process.exit(1);\n  }\n  outDir = resolvedOut;\n} else {\n  outDir = path.join('.', 'skills', safeId);              // \u003c-- NO traversal check\n}\n\nif (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });\n```\n\nThree problems compose:\n\n1. **The regex allow-list permits `.`** — `[^a-zA-Z0-9_\\-\\.]` only strips characters *outside* this set, so the literal dot is preserved. A `skill_id` of `..` (verified: `'..'.replace(/[^a-zA-Z0-9_\\-\\.]/g,'_') === '..'`) survives sanitization.\n2. **`path.join` collapses `..` traversal** — `path.join('.', 'skills', '..')` evaluates to `'.'` (the cwd), so `outDir` is now the user's working directory rather than `./skills/\u003cid\u003e`.\n3. **The traversal validation only runs in the `--out` branch** — the default branch (the documented common case for `evolver fetch --skill \u003cid\u003e`) has no `path.relative(...).startsWith('..')` check.\n\nThe bundled-files write loop:\n\n```js\n// index.js:881-906\nconst ALLOWED_SKILL_EXTENSIONS = new Set([\n  '.js', '.mjs', '.cjs', '.ts', '.json', '.md', '.txt',\n  '.sh', '.py', '.yml', '.yaml',\n]);\n// ...\nfor (const file of bundled) {\n  if (!file || !file.name || typeof file.content !== 'string') continue;\n  const safeName = path.basename(file.name);                       // basename of \"index.js\" is \"index.js\"\n  const ext = path.extname(safeName).toLowerCase();\n  if (!ALLOWED_SKILL_EXTENSIONS.has(ext)) { /* skip */ continue; }\n  if (Buffer.byteLength(file.content, 'utf8') \u003e MAX_SKILL_FILE_BYTES) { /* skip */ continue; }\n  fs.writeFileSync(path.join(outDir, safeName), file.content, 'utf8');\n}\n```\n\n`path.basename` strips directory components from the *file name*, but a basename of `index.js` is still `index.js`. The extension allow-list contains `.js`, so an attacker can write `./index.js` (the evolver entry point itself), `./package.json`, `./SKILL.md`, etc.\n\nThere is no signature verification on the Hub response. `buildHubHeaders()` only authenticates the *outgoing* request; the response body is trusted as-is. The Hub stores skills uploaded by network participants, so any participant who can set a stored `skill_id` field to `..` triggers this on every download.\n\n## PoC\n\nReproduces the exact code path from `index.js:849-905`:\n\n```bash\ncd /tmp \u0026\u0026 rm -rf evolver-poc-validate \u0026\u0026 mkdir evolver-poc-validate \u0026\u0026 \\\n  cp /path/to/EvoMap-evolver-src/index.js evolver-poc-validate/\ncd evolver-poc-validate\nwc -l index.js                                  # 1098 index.js (legitimate)\n\nnode -e \"\nconst fs=require('fs'),path=require('path');\nconst data={\n  skill_id:'..',\n  content:'x',\n  bundled_files:[{name:'index.js',content:'#!/usr/bin/env node\\nconsole.log(\\\"PWNED\\\");'}]\n};\nconst safeId=String(data.skill_id||'x').replace(/[^a-zA-Z0-9_\\-\\.]/g,'_');\nconst outDir=path.join('.','skills',safeId);\nconsole.log('safeId:',JSON.stringify(safeId));   // '..'\nconsole.log('outDir:',JSON.stringify(outDir));   // '.'\nif(!fs.existsSync(outDir))fs.mkdirSync(outDir,{recursive:true});\nfor(const f of data.bundled_files){\n  const n=path.basename(f.name);\n  fs.writeFileSync(path.join(outDir,n),f.content);\n}\"\n\nwc -l index.js                                  # 1 index.js  (clobbered)\nhead -3 index.js\n# #!/usr/bin/env node\n# console.log(\"PWNED\");\n```\n\nVerified output: 1098 → 1 line; the legitimate evolver entry point is replaced with attacker-controlled JavaScript. Any subsequent `node index.js \u003ccommand\u003e` (including the `--loop` daemon mode that users run continuously) executes the attacker payload.\n\nEnd-to-end attack:\n1. Attacker uploads a skill to the A2A Hub whose stored `skill_id` is `..` (or operates a malicious Hub / MitMs the connection / supplies a malicious `A2A_HUB_URL`).\n2. The malicious response also carries `bundled_files: [{name: 'index.js', content: '\u003cattacker JS\u003e'}]`.\n3. Victim runs `node index.js fetch --skill=anything` from the evolver checkout (the documented usage).\n4. `./index.js` is overwritten in place.\n5. Victim's next `node index.js` invocation — even just `node index.js --help` or the `run --loop` daemon — executes attacker code with the victim's privileges.\n\n## Impact\n\n- **Remote code execution** in the victim's environment with the privileges of the evolver process. Because the loop daemon (`node index.js run --loop`) is the documented long-running mode, the malicious code typically gets executed within seconds of the next iteration.\n- Attacker can also overwrite `package.json` (allowed extension), `SKILL.md`, `.env`-adjacent `.json`/`.yaml`/`.yml` config files, and any whitelisted file already present in the cwd.\n- Trust boundary violation: `evolver fetch` is presented as a *download* operation; users would not expect it to overwrite the application binary or project files. The `--out` branch was hardened against exactly this; the default branch was missed.\n- A single malicious skill upload compromises every user that fetches it.\n\n## Recommended Fix\n\nReject `safeId` values that are not single non-traversing path segments before joining, or reuse the same `path.relative` check used in the `--out` branch. Minimal patch around `index.js:849`:\n\n```js\nconst safeId = String(data.skill_id || skillId).replace(/[^a-zA-Z0-9_\\-\\.]/g, '_');\nif (\n  safeId === '' ||\n  safeId === '.' ||\n  safeId === '..' ||\n  safeId.includes('/') ||\n  safeId.includes('\\\\') ||\n  safeId.includes('\\0')\n) {\n  console.error('[fetch] Hub returned an invalid skill_id: ' + JSON.stringify(safeId));\n  process.exit(1);\n}\n```\n\nDefense in depth — apply the existing traversal check to the default branch as well:\n\n```js\n} else {\n  const candidate = path.resolve(process.cwd(), 'skills', safeId);\n  const skillsRoot = path.resolve(process.cwd(), 'skills');\n  const rel = path.relative(skillsRoot, candidate);\n  if (rel.startsWith('..') || path.isAbsolute(rel)) {\n    console.error('[fetch] Hub returned a skill_id that escapes the skills/ directory');\n    process.exit(1);\n  }\n  outDir = candidate;\n}\n```\n\nAdditionally, consider:\n- Removing `.` from the regex allow-list (skill IDs typically don't need dots).\n- Verifying a Hub-supplied signature over the response payload before writing any file to disk.\n- Disallowing bundled-file `safeName` values that match top-level project files (`index.js`, `package.json`, `package-lock.json`, etc.) regardless of `outDir`.","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"The `evolver fetch` subcommand in `index.js` writes Hub-supplied `bundled_files[]` into a directory derived from a Hub-supplied `skill_id`.","id":"GHSA-cfcj-hqpf-hccf","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"path_traversal","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["1.70.0-beta.5"],"introduced":["0"],"last_affected":[],"package":"@evomap/evolver","purl":null,"source":"GHSA-cfcj-hqpf-hccf"},{"ecosystem":"npm","fixed":["1.70.0-beta.5"],"introduced":["0"],"last_affected":[],"package":"@evomap/evolver","purl":"pkg:npm/%40evomap/evolver","source":"GHSA-cfcj-hqpf-hccf"}],"products":null,"published":"2026-05-05","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"A malicious Hub can overwrite project files via path traversal in evolver fetch, leading to remote code execution on the next invocation.","url":"https://insights.sbomify.com/GHSA-cfcj-hqpf-hccf/"}