GHSA-r9x7-7ggj-fx9f PrivateBin vulnerable to malicious filename use for self-XSS / HTML injection locally for users
SummaryDragging a file whose filename contains HTML is reflected verbatim into the page via the drag-and-drop helper, so any user who drops a crafted file on PrivateBin will execute arbitrary JavaScript within their own session (self-XSS). This allows an attacker who can entice a victim to drag or otherwise attach such a file to exfiltrate plaintext, encryption keys, or stored pastes before they are encrypted or sent.**Note 1:** as the malicious filename must contain the `>` character, the victim must not be using Windows for this to work, since this OS simply forbids this character in filenames.**Note 2:** most PrivateBin instances use the Content-Security-Policy header to prevent most use-cases of this vulnerability. This report will describe the impact as if this header had been disabled by the PrivateBin instance owner.Affected versionsPrivateBin versions since 1.7.7 and before 2.0.3.ConditionsOnly macIOS or Linux users are affected, due to the way the `>` character is treated in a file name on Windows.The PrivateBIn instance needs to have file upload enabled.An attacker needs to have access to the local file system or somehow convince the user to create (or download) a malicious file (name).An attacker needs to convince the user to attach that malicious file to PrivateBin.ImpactAny Mac / Linux user who can be tricked into dragging a maliciously named file into the editor is impacted; code runs in the origin of the PrivateBin instance they are using. Attackers can steal plaintext, passphrases, or manipulate the UI before data is encrypted, defeating the zero-knowledge guarantees for that victim session, assuming counter-measures like Content-Security-Policy (CSP) have been disabled.If CSP is not disabled, similar HTML injection attacks as described in CVE-2025-62796 may be possible - like redirecting to a foreign website, phishing etc.Real-life impactAs the whole exploit needs to be included in the file name of the attached file and only affects the local session of the user (aka it is neither persistent nor remotely executable) _and_ that user needs to interact and actively attach that file to the paste, the impact is considered to be practically low.Technical DescriptionWhen a file is dropped, `readFileData` collects all filenames and calls `printDragAndDropFileNames`:`printDragAndDropFileNames` then renders those names:This will insecurely render the user-submitted filenames as HTML.This vulnerability has been introduced in [this commit](https://github.com/PrivateBin/PrivateBin/commit/095a5be0b6390a6e47b97d3668a23f6edec95c15) (introduced in 1.7.7).The previous render method was using `.text()`:Reproduction StepsOn a Unix-like system, create a file with an HTML/JS payload in its name, e.g. by running `touch '"><img src=x onerror=alert(document.domain)>.txt'`.Deploy or use any PrivateBin instance with attachments enabled (including https://privatebin.net/).Open the UI in a browser and start a new paste.Drag the crafted file anywhere on the pageAs soon as it is dropped, the filename is inserted into `#dragAndDropFileName` as HTML and the onerror handler fires (assuming CSP is disabled), showing the alert.MitigationPrivateBin strongly recommends users to **upgrade to the latest release**. However, here are some workarounds that may help users to mitigate this vulnerability without upgrade:Update the [CSP in your configuration file](https://github.com/PrivateBin/PrivateBin/wiki/Configuration#cspheader) to the latest recommended settings and check that it isn't getting reverted or overwritten by the web server, reverse proxy or CDN, i.e. using [PrivateBin's offered check service](https://privatebin.info/directory/check).
 **Note:** Users should check the CSP independently, even if they've upgrade to a fixed version.Deploying PrivateBin on a separate domain may limit the scope of the vulnerability to PrivateBin itself and thus, as described in the “Impact” section, effectively prevent any damage by the vulnerability to other resources users are hosting.As explained in the impact assessment, disabling attachments also prevents this issue.PatchesThe issue has been patched in version 2.0.3.CreditsPrivateBin would like to thank [Benoit Esnard](https://github.com/esnard), who reported this vulnerability.In general, PrivateBin would like to thank everyone reporting issues and potential vulnerabilities.If a user thinks they have found a vulnerability or potential security risk, [PrivateBin would kindly ask you to follow our security policy](https://github.com/PrivateBin/PrivateBin/blob/master/SECURITY.md) and report it. PrivateBin will then assess the report and will take the necessary actions to address it.Timeline2025-11-09 Received report via GitHub Security Advisory2025-11-10 Discussed and reproduced issue, created a patch2025-11-11 Further work on patch2025-11-12 Released patch with PrivateBin 2.0.3
CVSS v3.1 score: 3.9