Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
HIGH severity

GHSA-2mf3-mr2r-r4vf

HIGHFix: gina-io/swig@381bdc3

GHSA-2mf3-mr2r-r4vf is a high-severity (CVSS 7.5) vulnerability in @rhinostone/swig. O3 Security confirms whether GHSA-2mf3-mr2r-r4vf is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.

@rhinostone/swig: arbitrary local file read via include/extends path traversal

Published
Aug 18, 2026
Updated
Aug 18, 2026
Affected
5 pkgs
Patched
5 / 5
Exploits
None indexed
Exploitation data as of Aug 18, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

5 pkgs affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

1other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
@rhinostone/swignpm
786downloads / week
@rhinostone/swig-corenpm
770downloads / week
@rhinostone/swig-twignpm
43downloads / week

Description

Overview

@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.

Attack scenario

The 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:

// application code — a configured filesystem loader with a basepath
swig.renderFile('page.html', { partial: req.query.partial });
{# page.html — trusted template #}
{% include partial %}

Setting ?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" %}.

Impact

Arbitrary 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.

Affected & patched

Every 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.

Fixed 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.

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.

Workarounds

  • Upgrade to 2.7.2 (or later).
  • If you cannot upgrade immediately: configure the filesystem loader with an explicit basepath, and never pass untrusted data into an {% include %} / {% extends %} / {% import %} path.

References

Affected Packages

5 total 5 fixed
EcosystemPackageVulnerable rangeFix
📦npm@rhinostone/swigall versions2.7.1
📦npm@rhinostone/swig-coreall versions2.7.1
📦npm@rhinostone/swig-twigall versions2.7.1
📦npm@rhinostone/swig-jinja2all versions2.7.1
📦npm@rhinostone/swig-djangoall versions2.7.1

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @rhinostone/swig. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Fix

    Update @rhinostone/swig to 2.7.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-2mf3-mr2r-r4vf is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether GHSA-2mf3-mr2r-r4vf is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to GHSA-2mf3-mr2r-r4vf. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Overview `@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. ### Attack scenario The dangerous case does **not** r
O3 Security · Impact-Aware SCA

Is GHSA-2mf3-mr2r-r4vf in your dependencies?

O3 detects GHSA-2mf3-mr2r-r4vf across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.