{"id":"CVE-2026-39859","aliases":["CVE-2026-39859","GHSA-v273-448j-v4qj"],"related":[],"kind":"vulnerability","state":"published","title":"LiquidJS has a renderFile() / parseFile() bypass configured root and allow arbitrary file read","summary":"LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. Prior to 10.25.3, liquidjs 10.25.0 documents root as constraining filenames passed to renderFile() and parseFile(), but top-level file loads do not enforce that boundary. A Liquid instance configured with an empty temporary directory as root can return the contents of arbitrary files. This vulnerability is fixed in 10.25.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"LiquidJS is a Shopify / GitHub Pages compatible template engine in pure JavaScript. Prior to 10.25.3, liquidjs 10.25.0 documents root as constraining filenames passed to renderFile() and parseFile(), but top-level file loads do not enforce that boundary. A Liquid instance configured with an empty temporary directory as root can return the contents of arbitrary files. This vulnerability is fixed in 10.25.3.","source":"cvelist"},{"lang":"en","text":"`liquidjs` 10.25.0 documents `root` as constraining filenames passed to `renderFile()` and `parseFile()`, but top-level file loads do not enforce that boundary.\n\nThe published npm package `liquidjs@10.25.0` on Linux 6.17.0 with Node v22.22.1. A `Liquid` instance configured with an empty temporary directory as `root` still returned the contents of `/etc/hosts` when `renderFile('/etc/hosts')` was called. I have not exhaustively checked older releases yet; 10.25.0 is the latest tested version.\n\nRoot cause:\n- `src/parser/parser.ts:83-85` calls `loader.lookup(file, LookupType.Root, ...)` and then reads the returned file.\n- `src/fs/loader.ts:38` passes `type !== LookupType.Root` into `candidates()`.\n- For `LookupType.Root`, `enforceRoot` is false, so `src/fs/loader.ts:47-66` accepts resolved absolute paths and fallback results without any `contains()` check.\n\nThis appears adjacent to the March 10, 2026 fix for CVE-2026-30952, which hardened `include` / `render` / `layout` but not the top-level file-loading APIs.\n\nProof of concept:\n```javascript\nconst fs = require('fs');\nconst os = require('os');\nconst path = require('path');\nconst { Liquid } = require('liquidjs');\n\nconst safeRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'liquidjs-safe-root-'));\nconst engine = new Liquid({ root: [safeRoot], extname: '.liquid' });\n\nengine.renderFile('/etc/hosts').then(console.log);\n```\n\nExpected result: a path outside `root` should be rejected.\nActual result: `/etc/hosts` is rendered successfully.\n\nImpact: any application that treats `root` as a sandbox boundary and forwards attacker-controlled template names into `renderFile()` or `parseFile()` can disclose arbitrary local files readable by the server process.\n\nSuggested fix: apply the same containment checks used for partial/layout lookups to `LookupType.Root`, and reject absolute or fallback paths unless they remain within an allowed root. A regression test should verify that `renderFile('/etc/hosts')` fails when `root` points to an unrelated directory.","format":"markdown","source":"ghsa"},{"lang":"es","text":"LiquidJS es un motor de plantillas compatible con Shopify / GitHub Pages en JavaScript puro. Antes de la versión 10.25.3, liquidjs 10.25.0 documenta 'root' como un elemento que restringe los nombres de archivo pasados a renderFile() y parseFile(), pero las cargas de archivos de nivel superior no aplican ese límite. Una instancia de Liquid configurada con un directorio temporal vacío como 'root' puede devolver el contenido de archivos arbitrarios. Esta vulnerabilidad se corrige en la versión 10.25.3.","source":"nvd"}],"published":"2026-04-08T15:04:44.000Z","modified":"2026-09-10T03:50:44.797Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 10.25.3","status":"affected"}],"vendor":"harttle","product":"liquidjs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"10.25.5"}],"ecosystem":"npm","package":"liquidjs","purl":"pkg:npm/liquidjs","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"10.25.3"}],"vendor":"liquidjs","product":"liquidjs","cpe":"cpe:2.3:a:liquidjs:liquidjs:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/harttle/liquidjs/security/advisories/GHSA-v273-448j-v4qj","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39859","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/harttle/liquidjs/pull/870","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/harttle/liquidjs/commit/f41c1fc02fe901598f3328118b42b13bc6bc9b04","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/harttle/liquidjs","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/harttle/liquidjs/releases/tag/v10.25.5","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-04-10T20:45:15.694Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-39859","url":"https://www.cve.org/CVERecord?id=CVE-2026-39859","licence":"CVE Terms of Use","modified":"2026-04-10T20:45:55.071Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-v273-448j-v4qj","url":"https://github.com/advisories/GHSA-v273-448j-v4qj","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:44.797Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-39859","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39859","licence":"Public domain","modified":"2026-07-24T21:10:00.143Z"}],"updatedAt":"2026-11-25T22:59:18.308Z","epss":{"score":0.00475,"percentile":0.42695,"date":"2026-12-01T12:00:22.000Z"}}