Skip to content
Heist/ feed
Back to feed
Medium

esm.sh writes arbitrary files via path traversal in `X-Zone-Id` header

Type: advisorySources: OSV

esm.sh is a nobuild content delivery network(CDN) for modern web development. In 136 and earlier, a path-traversal flaw in the handling of the X-Zone-Id HTTP header allows an attacker to cause the application to write files outside the intended storage location. The header value is used to build a filesystem path but is not properly canonicalized or restricted to the application’s storage base directory. As a result, supplying ../ sequences in X-Zone-Id causes files to be written to arbitrary directories. Version 136.1 contains a patch.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2025-59342
Confirmed fixed CVEs
Not specified
Updated in this feed
3 Nov 2026, 15:04 UTC · Revision 1

Source evidence

esm.sh writes arbitrary files via path traversal in `X-Zone-Id` header

core-osv · Original source

Published 17 Sept 2025, 17:59 UTC

esm.sh is a nobuild content delivery network(CDN) for modern web development. In 136 and earlier, a path-traversal flaw in the handling of the X-Zone-Id HTTP header allows an attacker to cause the application to write files outside the intended storage location. The header value is used to build a filesystem path but is not properly canonicalized or restricted to the application’s storage base directory. As a result, supplying ../ sequences in X-Zone-Id causes files to be written to arbitrary directories. Version 136.1 contains a patch.

osv:CVE-2025-59342
Complete source record
{
  "id": "751b4476f58b306f06513acabb2b9e660d50a4c416d0dbe7c79937a8ca2b84b4",
  "url": "https://osv.dev/vulnerability/CVE-2025-59342",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "esm.sh writes arbitrary files via path traversal in `X-Zone-Id` header",
    "summary": "esm.sh is a nobuild content delivery network(CDN) for modern web development. In 136 and earlier, a path-traversal flaw in the handling of the X-Zone-Id HTTP header allows an attacker to cause the application to write files outside the intended storage location. The header value is used to build a filesystem path but is not properly canonicalized or restricted to the application’s storage base directory. As a result, supplying ../ sequences in X-Zone-Id causes files to be written to arbitrary directories. Version 136.1 contains a patch.",
    "evidence": "osv:CVE-2025-59342",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2025-59342",
      "aliases": [
        "CVE-2025-59342",
        "GHSA-g2h5-cvvr-7gmw",
        "GO-2025-3967"
      ],
      "metrics": [
        {
          "type": "CVSS_V4",
          "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/esm-dev/esm.sh",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "833a29f42aeb0acbd7089a71be11dd0a292d3151"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "last_affected": "136"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "833a29f42aeb0acbd7089a71be11dd0a292d3151"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v136",
            "v135_1",
            "v135",
            "v134",
            "v133",
            "v132",
            "v131",
            "v130",
            "v129",
            "v128",
            "v127",
            "v126",
            "v125",
            "v124",
            "v123",
            "v122",
            "v121",
            "v120",
            "v119",
            "v117",
            "v116",
            "v115",
            "v114",
            "v113",
            "v112",
            "v111",
            "v110",
            "v109",
            "v108",
            "v107",
            "v106",
            "v105",
            "v104",
            "v103",
            "v102",
            "v101",
            "v100",
            "v99",
            "v98",
            "v97",
            "v96",
            "v95",
            "v94",
            "v93",
            "v92",
            "v91",
            "v90",
            "v89",
            "v88",
            "v87",
            "v86",
            "v85",
            "v84",
            "v83",
            "v82",
            "v81",
            "v80",
            "v79",
            "v78",
            "v77",
            "v76",
            "v75",
            "v74",
            "v73",
            "v72",
            "v71",
            "v70",
            "v69",
            "v68",
            "v67",
            "v66",
            "v65",
            "v64",
            "v63",
            "v62",
            "v61",
            "v60",
            "v59",
            "v57",
            "v56",
            "v55",
            "v53",
            "v52",
            "v51",
            "v50",
            "v49",
            "v47",
            "v46",
            "v45",
            "v44",
            "v43",
            "v41",
            "v40",
            "v39",
            "v38",
            "v37",
            "v35",
            "v34"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-59342.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:30.022975992Z",
      "provider": "osv",
      "references": [
        "https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L116",
        "https://github.com/esm-dev/esm.sh/blob/main/server/router.go#L411",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/59xxx/CVE-2025-59342.json",
        "https://github.com/esm-dev/esm.sh/security/advisories/GHSA-g2h5-cvvr-7gmw",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-59342",
        "https://github.com/esm-dev/esm.sh/commit/833a29f42aeb0acbd7089a71be11dd0a292d3151"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-24"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/59xxx/CVE-2025-59342.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-59342",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 496644,
  "published_at": "2025-09-17T17:59:34.163+00:00"
}