/

CVE-2025-69437

Severity:

HIGH RISK

(8.7)

Stored Cross-Site Scripting (XSS) in PublicCMS File Handling

CVE-2025-69437

Analyzed

Vulnerability type

Category:

Stored Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Client-Side Code Execution / Session Compromise

Severity:

HIGH RISK

(8.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PublicCMS v5.202506.d and earlier contains a stored cross-site scripting vulnerability in its file upload and rendering pipeline, where uploaded PDF files with embedded JavaScript are not adequately sanitized or blocked.

When a user uploads and later views a crafted PDF through the CMS, the embedded script can execute in their browser, enabling credential theft, arbitrary API calls, and other client-side attacks within the context of the affected site.

Affected context

This vulnerability appears in the PublicCMS file upload and handling logic, specifically when PDFs are accepted as user-uploaded content and then rendered or served in a way that allows embedded JavaScript to run.

It is relevant wherever:

  • Users (including content editors or administrators) can upload PDF files via CMS endpoints, and
  • Those files are later viewed from within authenticated CMS sessions or embedded in CMS pages.

Affected endpoints include, but may not be limited to:

  • /cmsTemplate/save
  • /file/doUpload
  • /cmsTemplate/doUpload
  • /file/doBatchUpload
  • /cmsWebFile/doUpload

Exploit preconditions

  • Attack surface: Web-based file upload interfaces in PublicCMS.
  • Required access: Ability to authenticate (or otherwise reach) any endpoint that accepts PDF uploads; typically a CMS user or another role permitted to upload files.
  • Trigger point: A victim—often an administrator, editor, or other user—opens or previews the uploaded PDF via the CMS or a CMS-served URL.
  • Why exploitation is possible: The backend file handling logic (e.g., CmsFileUtils.java) does not reliably strip or block active content within PDFs or enforce strict content-type and rendering rules, allowing embedded JavaScript to execute when the PDF is rendered in a browser context associated with the CMS origin.

Why this happens

The root cause is insufficient output handling and validation of active content in uploaded files that are later rendered in a browser, a classic case of CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting) in a stored form.

Instead of treating uploaded PDFs as potentially hostile and enforcing a strict "data-only" contract, the application allows PDFs containing JavaScript or script-like constructs to be uploaded and then served without appropriate sanitization, content disarming, or restrictive rendering headers.

As a result, when the PDF is accessed through the CMS, the browser can execute the embedded script in the security context of the CMS domain, effectively turning the file upload feature into a persistent script injection channel.

Potential impact

  • Theft of user credentials, including session cookies or tokens, from affected browsers.
  • Execution of arbitrary JavaScript within the CMS origin, enabling manipulation of UI, data, and user actions.
  • Unauthorized invocation of CMS APIs as the logged-in victim (e.g., content changes, configuration updates, or account actions).
  • Exfiltration or tampering with sensitive data accessible to the victim's session.
  • Lateral movement by abusing administrator or privileged accounts that view malicious PDFs.
  • Degradation of user trust and potential compliance or regulatory consequences if personal data is exposed.

General mitigation guidance

Mitigation generally focuses on treating all uploaded content as untrusted and ensuring that no active content can execute in a privileged browser context.

Recommended patterns include:

  • Enforce strict content validation on uploads:
  • Reject PDFs that contain JavaScript or other active content.
  • Perform server-side "content disarm and reconstruction" (CDR) to strip scripts and dynamic elements where feasible.
  • Apply strong response headers when serving user-uploaded files:
  • Use Content-Disposition: attachment for PDFs and other complex file types to encourage download instead of inline execution.
  • Set Content-Type accurately and avoid serving untrusted files in HTML or mixed contexts.
  • Use X-Content-Type-Options: nosniff to prevent MIME-type confusion.
  • Segregate user-uploaded content:
  • Serve uploaded files from a separate domain or subdomain (e.g., files.example.com) without access to sensitive cookies.
  • Ensure that authentication cookies are not sent to the file-serving domain via cookie scope settings.
  • Reduce privileges and trust:
  • Limit which roles are allowed to upload PDFs or other active file formats.
  • Apply least-privilege role design so that compromise of a lower-privileged user has constrained blast radius.
  • Implement consistent sanitization and encoding standards for any content that might appear in HTML contexts, even when it originates from files.

How teams detect issues like this

Detecting and monitoring for this class of vulnerability can involve:

  • Static analysis and code review:
  • Flag any file upload paths that store and later render files without clear sanitization or type enforcement.
  • Look for places where PDFs or other rich document types are served inline from the same origin and path space as the main application.
  • Review CmsFileUtils.java and related utilities for assumptions about PDF safety and lack of active-content checks.
  • Security testing and dynamic analysis:
  • Integrate automated tests that upload benign PDFs augmented with harmless JavaScript markers and then verify if any script is executed when viewing the file.
  • Use DAST tools configured to exercise file upload endpoints and attempt basic stored XSS probes.
  • Operational monitoring:
  • Log and monitor access to uploaded PDFs and other user-controlled files, especially those accessed by administrative users.
  • Analyze Content Security Policy (CSP) violation reports (if CSP is in place) to identify unexpected script execution from uploaded file origins.
  • Pipeline enforcement:
  • Introduce CI policies requiring review of any new file upload endpoints.
  • Use automated code review tools or SAST scanners with rules tailored for stored XSS and unsafe file rendering patterns.

Sources

SourceLink
github.comgithub.com/sanluan/PublicCMS/issues/103

Frequently asked

questions

Yes. An attacker who can reach an upload endpoint and submit a crafted PDF can exploit this issue. The attack becomes effective when another user (often a privileged CMS user) later views the uploaded PDF via the application.

In most deployments, yes—some level of access is typically required to upload files (such as an editor or contributor role). However, if any upload endpoint is exposed to anonymous users, then exploitation could occur without authentication.

The most robust approach is to treat uploaded PDFs as untrusted binary data: block or strip active content, serve them from a segregated origin, and default to non-inline rendering (e.g., forced download). Coupling this with strict content-type handling and security headers significantly reduces the chance of script execution.

Adopt a secure design pattern for all file uploads: implement consistent validation and sanitization, serve untrusted files from isolated domains, avoid mixing user-controlled files into HTML responses, and require security review for any new upload or preview functionality. Regularly include file upload and stored XSS scenarios in both manual and automated security testing.

Find out what's already
exploitable in your codebase.