Summary
Stirling-PDF may render untrusted PDF Title and Author metadata with innerHTML in the Get Info workflow, allowing malicious metadata to become stored cross-site scripting in the application page.
When a user opens the affected workflow and clicks Get Info on a crafted PDF, injected script may access browser-session data or alter displayed page content.
Affected context
The issue occurs in Stirling-PDF deployments using the Get Info workflow before the relevant security fix, where PDF metadata is inserted into the summary-text element through an HTML-interpreting sink. Risk depends on whether an attacker can supply or cause a user to process a PDF containing crafted Title or Author metadata and whether the resulting page is viewed in an authenticated browser session.
Exploit preconditions
- Attack surface: The Get Info PDF-processing workflow in the web application
- Required access: Ability to provide, upload, or otherwise cause processing of a PDF containing malicious metadata
- Trigger point: A user clicks Get Info and the application renders the PDF Title or Author in the summary page
- Why exploitation is possible: Untrusted metadata reaches
innerHTMLwithout adequate context-sensitive output encoding, allowing browser interpretation as active markup or script
Why this happens
The underlying bug is an unsafe output-rendering pattern in which PDF metadata is treated as trusted HTML. Assigning untrusted values to innerHTML allows attacker-controlled markup to be interpreted by the browser instead of displayed as text.
This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), specifically a stored or persistence-assisted XSS condition where attacker-controlled content is rendered in a later browser interaction.
Potential impact
- An attacker may execute JavaScript in the context of the Stirling-PDF application
- The script could access browser-readable session data or other exposed application information
- The attacker could modify page content or alter user-visible workflow results
- The vulnerability could enable unauthorized actions permitted by the victim's active session
- A malicious document could affect multiple users if it is shared or processed repeatedly
General mitigation guidance
Mitigation generally focuses on treating all document metadata as untrusted and preventing it from entering HTML interpretation contexts.
Common defensive patterns include:
- Render metadata through text-only APIs such as
textContentor equivalent templating mechanisms - Apply context-aware output encoding when values must appear in HTML
- Avoid assigning untrusted data to
innerHTMLor other active-content sinks - Enforce a restrictive Content Security Policy as defense in depth
- Limit session privileges and protect sensitive cookies with appropriate browser security attributes
- Validate and sanitize document metadata according to its intended display format, without relying on validation alone as an XSS defense
How teams detect issues like this
Detection can include:
- Static analysis rules identifying assignments of document-derived values to
innerHTML, HTML template insertion, or similar browser sinks - Code review checks tracing PDF metadata from parsing APIs to rendered page elements
- Tests using harmless HTML-like marker strings in Title and Author fields to verify that output remains text
- Runtime monitoring for unexpected script execution, DOM changes, or unusual browser requests following document processing
- Policy enforcement requiring safe DOM APIs and context-aware output encoding for untrusted data
Automated code review and web application security testing tools may help identify these patterns, but should be supplemented with data-flow review.

