{"answers":{"affected":"10 open source packages ship an affected version, including @rhinostone/swig, @rhinostone/swig-core and @rhinostone/swig-django.","exploited":"There is no known exploitation of GHSA-2mf3-mr2r-r4vf in the wild and no public exploit code.","fix":"Upgrade @rhinostone/swig to 2.7.1 or later.","what":"GHSA-2mf3-mr2r-r4vf is a path traversal vulnerability in @rhinostone/swig, published on 18 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-2mf3-mr2r-r4vf and fix it if it is affected.\n\nWhat it is: GHSA-2mf3-mr2r-r4vf is a path traversal vulnerability in @rhinostone/swig, published on 18 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-2mf3-mr2r-r4vf in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- @rhinostone/swig (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-core (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-core (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-django (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-django (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-jinja2 (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-jinja2 (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-twig (npm): affected all versions; fixed in 2.7.1\n- @rhinostone/swig-twig (npm): affected all versions; fixed in 2.7.1\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-2mf3-mr2r-r4vf/ (Markdown: https://insights.sbomify.com/GHSA-2mf3-mr2r-r4vf/index.md)","id":"GHSA-2mf3-mr2r-r4vf","markdown":"https://insights.sbomify.com/GHSA-2mf3-mr2r-r4vf/index.md","name":"GHSA-2mf3-mr2r-r4vf","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["data_read"],"network_reachable":"yes","non_default_config":false,"product_category":"Node.js template engine","requires_auth":"none","summary":"Attackers can read arbitrary local files by manipulating template include paths, exposing sensitive data like credentials and configuration.","user_interaction":"not_required","vuln_class":"path_traversal"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Overview\n\n`@rhinostone/swig` is a maintained fork of the abandoned `swig` template engine and inherited the directory-traversal vulnerability tracked upstream as CVE-2023-25345 / GHSA-2rq5-699j-x7p6. The `{% include %}`, `{% extends %}`, and `{% import %}` tags resolve their target path through the filesystem loader without confining the result to the configured template root. A path that traverses upward (`../`) escapes the root and reads an arbitrary file from the host filesystem, whose contents are emitted into the rendered output.\n\n### Attack scenario\n\nThe dangerous case does **not** require the attacker to control template source — only template **data** (the `locals` passed at render time). An application that renders a trusted template whose include / extends path is variable-driven is exposed:\n\n```js\n// application code — a configured filesystem loader with a basepath\nswig.renderFile('page.html', { partial: req.query.partial });\n```\n\n```\n{# page.html — trusted template #}\n{% include partial %}\n```\n\nSetting `?partial=../../../../etc/passwd` makes the loader resolve and read that file, and its contents are rendered into the response. A literal in trusted source is equally affected: `{% include \"../../../etc/passwd\" %}`.\n\n### Impact\n\nArbitrary local file disclosure (confidentiality). An attacker able to influence an include / extends / import path — directly, or via untrusted `locals` — can read files outside the template directory: application configuration, credentials, source code, `/etc/passwd`, and so on. There is no integrity or availability impact.\n\n### Affected \u0026 patched\n\nEvery published version up to and including `2.7.0` is affected — `@rhinostone/swig`, and the shared `@rhinostone/swig-core` loader, hence `@rhinostone/swig-twig`, `@rhinostone/swig-jinja2`, and `@rhinostone/swig-django` as well.\n\nFixed in **`2.7.1`**: the filesystem loader now rejects any `include` / `extends` / `import` path that resolves outside the configured `basepath` root, including paths supplied through an untrusted runtime variable. A new `allowOutsideRoot` loader option is available for the rare case of intentionally reading files from outside the root.\n\n**Upgrade to `2.7.2` or later:** `2.7.1` fixed the vulnerability but introduced a regression — a *relative* `basepath` wrongly rejected every in-root template path. `2.7.2` resolves the `basepath` to an absolute path before the check and restores correct in-root resolution.\n\n### Workarounds\n\n- Upgrade to `2.7.2` (or later).\n- If you cannot upgrade immediately: configure the filesystem loader with an explicit `basepath`, and never pass untrusted data into an `{% include %}` / `{% extends %}` / `{% import %}` path.\n\n### References\n\n- GHSA-2rq5-699j-x7p6 — https://github.com/advisories/GHSA-2rq5-699j-x7p6\n- CVE-2023-25345 (NVD) — https://nvd.nist.gov/vuln/detail/CVE-2023-25345\n- Upstream issue (swig-templates) — https://github.com/node-swig/swig-templates/issues/88\n- Fix commit — https://github.com/gina-io/swig/commit/381bdc305e0b10e45368d56324328b9b4f7017fc","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"@rhinostone/swig: arbitrary local file read via include/extends path traversal","id":"GHSA-2mf3-mr2r-r4vf","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"path_traversal","year":"2026"},"n_packages":10,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig","purl":null,"source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig","purl":"pkg:npm/%40rhinostone/swig","source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-core","purl":null,"source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-core","purl":"pkg:npm/%40rhinostone/swig-core","source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-django","purl":null,"source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-django","purl":"pkg:npm/%40rhinostone/swig-django","source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-jinja2","purl":null,"source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-jinja2","purl":"pkg:npm/%40rhinostone/swig-jinja2","source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-twig","purl":null,"source":"GHSA-2mf3-mr2r-r4vf"},{"ecosystem":"npm","fixed":["2.7.1"],"introduced":["0"],"last_affected":[],"package":"@rhinostone/swig-twig","purl":"pkg:npm/%40rhinostone/swig-twig","source":"GHSA-2mf3-mr2r-r4vf"}],"products":null,"published":"2026-08-18","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can read arbitrary local files by manipulating template include paths, exposing sensitive data like credentials and configuration.","url":"https://insights.sbomify.com/GHSA-2mf3-mr2r-r4vf/"}