Skip to content
File upload Write-up Beginner

One PDF Upload, One Click, Total Surprise

A support report feature accepted PDF uploads but only checked the file type or extension, not the internal structure. An attacker could upload a PDF with an /OpenAction directive that runs JavaScript when a support staff member downloads and opens it locally, though the platform's own preview did not execute it.

medium.com

Published on medium.com

While exploring the platform, I discovered a feature that allows users to send reports directly to the support team. The form was not limited to submitting a message — it also allowed users to upload PDF attachments.

Abdelrahman Maged, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Impact

An attacker could deliver active content to internal support staff, which executes when a staff member downloads and opens the attachment locally; the platform's own preview did not execute it.

What the attacker needed

Access to the support report form; victim downloads and opens the PDF locally

The fix

The upload feature should inspect and sanitise PDF internals, or strip active content such as /OpenAction, rather than relying only on file type or extension.

How it was found

  1. Test the PDF upload feature to see how files are validated.
  2. Notice that validation only checks file type or extension, not internal structure.
  3. Modify the PDF's internal structure to add an /OpenAction directive with a simple alert payload.
  4. Upload the modified PDF through the support report feature; it is accepted.
  5. Preview the file inside the platform; nothing happens because the built-in viewer disables script execution.
  6. Download and open the file locally; the payload executes before the PDF content is displayed.

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 write-up has not been written yet. The Original tab links to the source.

A PDF file can contain small programs that run automatically when the file is opened. The website only looked at the file's name ending in .pdf, not what was inside it, so it let a booby-trapped PDF through. When a support worker downloaded and opened that file on their own computer, the hidden program ran.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.