Skip to content
XSS Disclosed report Intermediate CVE-2020-8155CVE-2018-5158

XSS in PDF Viewer

An outdated version of PDF.js in the PDF viewer is vulnerable to CVE-2018-5158, allowing a malicious PDF to execute arbitrary JavaScript when opened. An attacker could run script in the context of the PDF viewer, though fetching further code was blocked by CORS.

skewbed Follow

Originally disclosed on HackerOne

Bounty$100 Low 3.5 View original
  • Triaged in 7 hours
  • Fixed in 3 days
  • Paid in 3 days
  • Disclosed after 2 months

Summary by the researcher

You can find my full write-up at https://tripplyons.com/blog/nextcloud-bug-bounty

The report

An outdated version of PDF.js in use allows for the CVE-2018-5158 vulnerability.

When the payload PDF is shown in the supplied PDF viewer, it can execute arbitrary JavaScript.

I have tested the payload PDF, and it is working in the Safari 13.0.5 (the latest version) and Firefox 74.0 (the latest version). Although, it does not work in the latest version of Chrome.

I could not find a way to test it on the desktop client. I assume that it would use the system PDF viewer.

Modifying the payload to fetch other code was luckily blocked because of a CORS policy.

The payload is from https://bugzilla.mozilla.org/show_bug.cgi?id=1452075. I have also included the PDF in the attachments.

The payload can be seen in action by checking the JavaScript console. It says "Hello, this is code running in" followed by the path to file where the vulnerability is.

Impact

An attacker could execute arbitrary JavaScript code on a web browser when a PDF containing an exploit is opened.

The original report as published on HackerOne, by skewbed. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could execute arbitrary JavaScript code on a web browser when a PDF containing an exploit is opened, though fetching other code was blocked by a CORS policy.

What the attacker needed

Victim opens a malicious PDF; PDF viewer uses vulnerable PDF.js

How it was found

  1. Open the malicious PDF in the supplied PDF viewer.
  2. Check the JavaScript console for the message indicating code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

PDF.js displays PDF files in a web page. Because the version was old, a crafted PDF could run JavaScript in the browser. Further code loading was stopped by a CORS policy.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.