Details
- Browse to http://127.0.0.1:8099/
- Type any text in the document area (e.g., "Quarterly report attached. Open the Download attachment link to view it.")
- Click Attach a file and select xss-attachment.html. The browser detects the file type as text/html, so the client produces attachment = ["data:text/html;base64,..."].
- Click Create. Copy the resulting paste URL.
Step 4: Victim opens the paste
- Open the paste URL in a browser. The paste decrypts and renders: "Download attachment (xss-attachment.html, ...)" with a blob: link.
- Right-click the "Download attachment" link and select Open in new tab (or middle-click).
Step 5: Observe XSS execution
The new tab opens at blob:http://127.0.0.1:8099/... with:
- Page title: XSS:127.0.0.1 (set by attacker script)
- Red background with
XSS EXECUTED, origin = http://127.0.0.1:8099, cookies = "", localstorage = ... - A same-origin fetch to the backend that returns real data (proving full origin access)
<img width="2208" height="856" alt="grafik" src="https://github.com/user-attachments/assets/b13678ac-6fba-4cb9-a7b5-ad2f9a12adc0" />
Negative control (default CSP):
Change cspheader in cfg/conf.php back to the recommended default:
cspheader = "default-src 'none'; base-uri 'self'; form-action 'none'; manifest-src 'self'; connect-src * blob:; script-src 'self' 'wasm-unsafe-eval'; style-src 'self'; font-src 'self'; frame-ancestors 'none'; frame-src blob:; img-src 'self' data: blob:; media-src blob:; object-src blob:; sandbox allow-same-origin allow-scripts allow-forms allow-modals allow-downloads"
Restart the server and open the same paste. The blob navigation now inherits script-src 'self' from the page CSP, blocking inline script execution. The browser console shows: *"Executing inline script violates the following Content Security Policy directive 'script-src 'self' 'wasm-unsafe-eval''"*. The page title stays "benign" (script didn't run).
Impact
Who is impacted:
Self-hosted PrivateBin instances that have both:
- File upload enabled (fileupload = true, default is false)
- A Content-Security-Policy that doesn't restrict inline scripts (the recommended CSP is weakened, stripped by a reverse proxy/CDN, or absent)
The CVE-2022-24833 advisory documented that such instances exist in the wild. Instances using PrivateBin's default recommended CSP are not affected.
What can an attacker do:
- Execute arbitrary JavaScript in the PrivateBin instance's web origin.
- Read localStorage and potentially other locally stored data (IndexDB, etc.) for that origin.
- Issue authenticated same-origin HTTP requests to the PrivateBin backend (which usually does not have any impact, as PrivateBin does not use traditional authentication methods) or any co-hosted application on the same domain.
What an attacker _cannot_ do:
- Exploit instances with the default recommended CSP (inline scripts are blocked in the blob).
- Exploit instances that don't have file upload enabled.
- Execute without victim interaction (the victim must open the attachment link in a new tab).
- Cookie access could _not_ be confirmed (see screenshot above), as these seem to be separated differently.
- Access to the opener via window.opener.document (same origin) could not be confirmed. (The link is just not opened via
window.openor similar)
That said, PrivateBin currently only stores user preferences (language, template, theme) in cookies or similar, so no authentication tokens or session data. Thus, similar to CVE-2022-24833, the practical risk exists for instances co-hosted with other applications.
Patches
To fix the problem, we took the following measures:
- Except for a list of safe common mime types used for media (video/audio/PDF etc.) we overwrite the mime-type with
application/octet-streamfor the download link. This causes the browser to always download the file – even if the user triggered a „Open in new tab“ action – with the exception of the mentioned mime-types. This ensures HTML or any other potentially malicious file types (SVG, XML etc.) are never rendered, mitigating any XSS attacks.
Timeline
- 2026-06-11 – Received report via GitHub Security Advisory by the reporter.
- 2026-06-11 – Report gets reviewed and discussed with the initial reporter.
- 2026-06-13 – Vulnerability gets reproduced and patch is being developed.
- 2026-06-14 – Patch gets reviewed.
- 2026-06-1X – Patch gets merged
- 2026-06-1X – New PrivateBin release is published.
- 2026-06-XX – Vulnerability details published.
Credits
This vulnerability was reported by Rizky Muhammad, @EvidentObscurity, which we'd like to thank for that.
In general, we'd like to thank everyone reporting issues and potential vulnerabilities to us.
If you think you have found a vulnerability or potential security risk, we'd kindly ask you to follow our security policy and report it to us. We then assess the report and will take the actions we deem necessary to address it.