{"id":"GHSA-wmfp-5q7x-987x","revision":"0122ddb581b543c59b2a58bf1f199693","records":[{"revision":"0122ddb581b543c59b2a58bf1f199693","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-wmfp-5q7x-987x","aliases":["CVE-2026-30952"],"title":"liquidjs has a path traversal fallback vulnerability","description":"### Impact\nThe `layout`, `render`, and `include` tags allow arbitrary file access via absolute paths (either as string literals or through Liquid variables, the latter require `dynamicPartials: true`, which is the default). This poses a security risk when malicious users are allowed to control the template content or specify the filepath to be included as a Liquid variable.\n\n### Patches\nThe root cause is LiquidJS allows `require.resolve()` as fallback but doesn't limit the directories it can resolve to. The issue is fixed via [#855](https://github.com/harttle/liquidjs/pull/855) and published version 10.25.0 on npm.\n\n### Workarounds\n#### Change the files in build time\nIn build time, through Shell script or Webpack `string-replace-loader`, change the file content of correxponding file (depending on your package `type`, for CommonJS it's `dist/liquid.node.js`) under `dist/`, \n\n```diff\n  if (fs.fallback !== undefined) {\n    const filepath = fs.fallback(file)\n-   if (filepath !== undefined) yield filepath\n+   if (filepath !== undefined) {\n+     for (const dir of dirs) {\n+       if (!enforceRoot || this.contains(dir, filepath)) {\n+         yield filepath\n+         break\n+       }\n+     }\n    }\n  }\n```\n\n#### Overriding by `fs` LiquidJS option\nAdding a [`fs` option](https://liquidjs.com/api/interfaces/FS.html) to override the [default `fs` implementation](https://github.com/harttle/liquidjs/blob/1b85fdaa9c535021f7030a239a64003af26d31b5/src/fs/fs-impl.ts#L36-L40):\n\n```javascript\nconst { statSync, readFileSync, promises: { stat, readFile } } = require('fs')\nconst { resolve, extname, dirname, sep } = require('path')\n\nconst fs = {\n    exists: async (fp) => { try { await stat(fp); return true; } catch { return false } },\n    existsSync: (fp) => { try { statSync(fp); return true } catch { return false } },\n    resolve: (root, file, ext) => resolve(root, file + (extname(file) ? '' : ext)),\n    contains: (root, file) => {\n        const r = resolve(root)\n        return file.startsWith(r.endsWith(sep) ? r : r + sep)\n    },\n    readFile: (fp) => readFile(fp, 'utf8'),\n    readFileSync: (fp) => readFileSync(fp, 'utf8'),\n    fallback: () => undefined,\n    dirname,\n    sep\n};\n\nconst engine = new Liquid({ fs })\n```\n\n### References\nDiscussions: https://github.com/harttle/liquidjs/pull/851\nCode fix: https://github.com/harttle/liquidjs/pull/855","state":0,"publishedAt":"2026-03-10T01:04:34+00:00","modifiedAt":"2026-09-10T03:50:41.5719359+00:00","affected":[{"ecosystem":"npm","name":"liquidjs","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"10.25.0"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V4","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/harttle/liquidjs/security/advisories/GHSA-wmfp-5q7x-987x","https://nvd.nist.gov/vuln/detail/CVE-2026-30952","https://github.com/harttle/liquidjs/pull/851","https://github.com/harttle/liquidjs/pull/855","https://github.com/harttle/liquidjs/commit/3cd024d652dc883c46307581e979fe32302adbac","https://github.com/harttle/liquidjs"],"sourceUrl":"https://github.com/advisories/GHSA-wmfp-5q7x-987x","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-wmfp-5q7x-987x","identifiers":["GHSA-wmfp-5q7x-987x","CVE-2026-30952"]},"retained":false,"historicalAffected":[]}],"coverage":[]}