GHSA-2mf3-mr2r-r4vfHigh· 7.5▾ Twilight@rhinostone/swig: arbitrary local file read via include/extends path traversal
▾ Twilight zone — High severity, or a signal on a lesser flaw
impact 41.3 · likelihood 0 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
@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.
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" %}.
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.
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.
2.7.2 (or later).basepath, and never pass untrusted data into an {% include %} / {% extends %} / {% import %} path.@rhinostone/swig < 2.7.1@rhinostone/swig-core < 2.7.1@rhinostone/swig-twig < 2.7.1@rhinostone/swig-jinja2 < 2.7.1@rhinostone/swig-django < 2.7.1Upgrade to a patched release:
@rhinostone/swig 2.7.1@rhinostone/swig-core 2.7.1@rhinostone/swig-twig 2.7.1@rhinostone/swig-jinja2 2.7.1@rhinostone/swig-django 2.7.1Connected by shared product, vendor, weakness, or advisory.
CVE-2023-7260High· 7.5Path Traversal vulnerability discovered in OpenText™ CX-E Voice, affecting all version through 22.4
CVE-2023-7249Critical· 9.8Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') vulnerability in OpenText OpenText Directory Services allows Path Traversal.This issue affects OpenText Directory Services: from 16.4.2 before 24.1.
CVE-2020-3365Medium· 4.3A vulnerability in the directory permissions of Cisco Enterprise NFV Infrastructure Software (NFVIS) could allow an authenticated, remote attacker to perform a directory traversal attack on a limited set of restricted directories
CVE-2020-3236Medium· 6.7A vulnerability in the CLI of Cisco Enterprise NFV Infrastructure Software (NFVIS) could allow an authenticated, local attacker to gain root shell access to the underlying operating system and overwrite or read arbitrary files
CVE-2010-2861Critical· 9.8Multiple directory traversal vulnerabilities in the administrator console in Adobe ColdFusion 9.0.1 and earlier allow remote attackers to read arbitrary files via the locale parameter to (1) CFIDE/administrator/settings/mappings.cfm, (2)…
CVE-2021-20023Medium· 4.9SonicWall Email Security version 10.0.9.x contains a vulnerability that allows a post-authenticated attacker to read an arbitrary file on the remote host.