CVE-2025-59788

6.4 MEDIUM

📋 TL;DR

This CVE describes a cross-site scripting (XSS) vulnerability in Nextcloud's files_pdfviewer example directory. Attackers can execute arbitrary JavaScript in users' browsers by uploading a crafted PDF file to viewer.html. This affects Nextcloud instances with exposed example code on same-origin basis across multiple versions.

💻 Affected Systems

Products:
  • Nextcloud
Versions: Versions before 22.2.10.33, 23.0.12.29, 24.0.12.28, 25.0.13.23, 26.0.13.20, 27.1.11.20, 28.0.14.11, 29.0.16.8, 30.0.17, 31.0.10, and 32.0.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in the files_pdfviewer example directory that is reachable on same-origin basis.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could steal session cookies, perform actions as authenticated users, redirect to malicious sites, or install malware via drive-by downloads.

🟠

Likely Case

Session hijacking, credential theft, or unauthorized actions within the Nextcloud instance.

🟢

If Mitigated

Limited impact if proper input validation and output encoding are implemented, or if example directories are removed.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires uploading a crafted PDF file to the vulnerable viewer.html endpoint.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 22.2.10.33, 23.0.12.29, 24.0.12.28, 25.0.13.23, 26.0.13.20, 27.1.11.20, 28.0.14.11, 29.0.16.8, 30.0.17, 31.0.10, 32.0.1 or later

Vendor Advisory: https://github.com/nextcloud/security-advisories/security/advisories/GHSA-24wp-p865-7j4r

Restart Required: No

Instructions:

1. Update Nextcloud to the patched version. 2. Follow Nextcloud's standard update procedure. 3. Verify the update completed successfully.

🔧 Temporary Workarounds

Remove example directory

linux

Delete or restrict access to the files_pdfviewer example directory

rm -rf /path/to/nextcloud/apps/files_pdfviewer/example/

Restrict file uploads

all

Implement strict file upload validation for PDF files

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block malicious PDF uploads
  • Disable or restrict access to the files_pdfviewer app entirely

🔍 How to Verify

Check if Vulnerable:

Check if Nextcloud version is in affected range and if files_pdfviewer/example/viewer.html is accessible

Check Version:

php occ status | grep 'versionstring'

Verify Fix Applied:

Verify Nextcloud version is patched and test that crafted PDF files no longer execute JavaScript

📡 Detection & Monitoring

Log Indicators:

  • Unusual PDF file uploads
  • Access to files_pdfviewer/example/viewer.html
  • JavaScript execution errors in logs

Network Indicators:

  • HTTP requests to viewer.html with PDF parameters
  • Unusual outbound connections after PDF upload

SIEM Query:

source="nextcloud.log" AND ("viewer.html" OR "files_pdfviewer/example")

🔗 References

📤 Share & Export