High, CVSS 7.5npmAmendedPublished
@rhinostone/swig: arbitrary local file read via include/extends path traversal
GHSA-2mf3-mr2r-r4vf
- Affected
- npm @rhinostone/swig-twig < 2.7.1
- Fixed in
- 2.7.1· Vendor fix available
- Issue
- @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: 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…
Recommended action: Upgrade to 2.7.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.