Miggo Logo

CVE-2025-62796: PrivateBin is missing HTML sanitization of attached filename in file size hint

5.8

CVSS Score
3.1

Basic Information

EPSS Score
-
Published
10/28/2025
Updated
10/28/2025
KEV Status
No
Technology
TechnologyPHP

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
privatebin/privatebincomposer>= 1.7.7, < 2.0.22.0.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability is a persistent Cross-Site Scripting (XSS) issue in PrivateBin, identified as GHSA-867c-p784-5q6g. It arises from the improper sanitization of the attachment_name field when a paste with an attachment is rendered. An attacker can set a malicious filename containing HTML and/or JavaScript, which gets encrypted and stored on the server. When a user views the paste, the client-side JavaScript decrypts the content and renders the malicious filename directly into the DOM without escaping, leading to XSS.

The fixing commit c4f8482b3072be7ae012cace1b3f5658dcc3b42e addresses this by changing how the filename is rendered. The analysis of the patch for js/privatebin.js reveals the exact point of vulnerability. The line template.append((${fileName}, ${fileSize})); uses jQuery's .append() method, which interprets the string as HTML. This was replaced with const fileInfo = document.createTextNode( (${fileName}, ${fileSize})); template[0].appendChild(fileInfo);, which treats the filename as plain text, thus mitigating the vulnerability.

The vulnerable code resides within an anonymous function inside the main jQuery.PrivateBin IIFE. This function is responsible for displaying the details of a decrypted paste, including the attachment information. While other parts of the script were also hardened in the same commit by replacing jQuery's DOM manipulation methods with safer, plain JavaScript alternatives, the core of this specific vulnerability lies in the handling of the attachment filename.

Vulnerable functions

jQuery.PrivateBin.(anonymous)
js/privatebin.js
This anonymous function, which is part of the paste rendering logic after decryption, appends the `fileName` to the DOM without proper sanitization. Since the `fileName` (from the `attachment_name` field) can be controlled by the attacker, this allows for persistent XSS. The fix was to use `document.createTextNode` to ensure the filename is treated as text.

WAF Protection Rules

WAF Rule

W*’v* i**nti*i** *n *TML inj**tion/XSS vuln*r**ility in Priv*t**in s*rvi** t**t *llows t** inj**tion o* *r*itr*ry *TML m*rkup vi* t** *tt***** *il*n*m*. **low *r* t** t***ni**l **t*ils, Po*, r*pro*u*tion st*ps, imp**t, *n* miti**tion r**omm*n**tions.

Reasoning

T** vuln*r**ility is * p*rsist*nt *ross-Sit* S*riptin* (XSS) issu* in Priv*t**in, i**nti*i** *s **S*-****-p***-*q**. It *ris*s *rom t** improp*r s*nitiz*tion o* t** `*tt***m*nt_n*m*` *i*l* w**n * p*st* wit* *n *tt***m*nt is r*n**r**. *n *tt**k*r **n