VYPR
Moderate severityNVD Advisory· Published Jul 3, 2018· Updated Sep 17, 2024

CVE-2018-3747

CVE-2018-3747

Description

The 'public' npm package ≤1.0.3 allows HTML injection via file names, enabling stored XSS when a directory listing is viewed in a browser.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

The 'public' npm package ≤1.0.3 allows HTML injection via file names, enabling stored XSS when a directory listing is viewed in a browser.

Vulnerability

The public npm package versions ≤1.0.3 [1] and <0.1.4 [2] mishandle file names that contain HTML. When a file is served from a directory that the package lists (e.g., auto-index), the raw file name is reflected without proper escaping. This allows an attacker who can upload or create files with crafted names (containing HTML tags) to inject persistent HTML into the directory listing page. [1][2]

Exploitation

An attacker needs write access to a directory served by the public module (e.g., via file upload or direct write on the server). The attacker creates a file whose name includes, for example, `. When a user requests the directory listing, the public` module renders the file name as-is, causing the embedded script to execute in the user's browser. No authentication other than the ability to place a file is required, but the victim must browse the directory listing. [1][2]

Impact

Successful exploitation results in stored cross-site scripting (XSS) in the context of the directory listing page. The attacker can execute arbitrary JavaScript in the victim's browser, potentially leading to session hijacking, credential theft, or further actions against the application or its users, depending on the site's cookie flags and CSP. [1][2]

Mitigation

Upgrade the public package to version 0.1.4 or later, which contains the fix. [2] The vulnerability is rated moderate severity by GitHub. No workaround is documented if upgrading is not possible; developers should sanitize file names before serving directory listings. [2]

AI Insight generated on May 22, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
publicnpm
< 0.1.40.1.4

Affected products

1

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

5

News mentions

0

No linked articles in our index yet.