I Uploaded a PDF and Got Stored XSS
A job application portal let candidates upload PDF resumes and then rendered them in a viewer that executed embedded JavaScript. An attacker could upload a malicious PDF so that a recruiter opening it would run code in their session, enabling session theft or account takeover.
medium.com
Published on medium.com
Bug Bounty Writeup
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.
Context
The target was a job application portal that accepted resumes as PDF uploads. The feature is ordinary: a candidate uploads a CV, and someone on the recruiting side later opens and previews the document. The researcher's point is that PDFs are widely treated as a safe file type, yet a PDF can carry JavaScript that runs through OpenAction entries when a viewer renders it.
Setup
The write-up does not describe any accounts, roles, tooling or versions. What it does establish is the precondition that matters: the application stores an uploaded PDF and then renders it back inside a viewer used by recruiters. No further access is needed beyond the ability to submit an application with an attached resume.
Finding it
While looking around the portal, the researcher noticed that resumes could be uploaded as PDFs and that the recruiting side previews them. The reasoning was that the upload check is not the whole story: if the application renders user-supplied documents in its own viewer, the renderer's handling of embedded JavaScript decides whether the file is safe. PDFs can run JavaScript via OpenActions, which the researcher notes most people forget.
Exploitation
Step 1: Build a PDF with an embedded JavaScript payload
The researcher created a PDF containing an embedded JavaScript alert payload. The write-up does not include the file or its source, so the exact OpenAction structure is not shown.
Step 2: Upload it as a resume
The PDF was submitted as the resume on a job application through the portal's normal upload flow. No request or response is reproduced in the write-up.
Step 3: Wait for the recruiter-side preview
The researcher then waited for the recruiting side to preview the document. When the PDF rendered in the application's viewer, the JavaScript fired. The result was stored XSS: the payload persisted in the uploaded document and executed when the document was opened, with no user interaction needed beyond opening it.

Root cause
The application accepted a PDF containing JavaScript and then rendered that PDF in a viewer that executed it. The upload check, whatever it validated, did not prevent an active document from being stored, and the rendering path did not isolate the document from the application's session. In other words, the renderer was trusted with content the user controls. The write-up does not describe the viewer or its configuration, so the precise reason JavaScript was allowed to run is not stated; The write-up does not describe the viewer or its configuration, so the precise reason JavaScript was allowed to run is not stated.
Impact
The payload ran in the session of whoever opened the resume, in this case a recruiter. The researcher lists the consequences as session theft, account takeover, or silently scraping candidate data. The condition is that a recruiter opens the document; beyond that, no interaction is required. The write-up does not quantify how many users or documents were affected.
Fix
The vendor sandboxed their PDF renderer and disabled JavaScript execution in uploaded documents. Both changes address the rendering path rather than the upload itself.
Timeline
| Day | Event |
|---|---|
| Day 0 | Reported |
| Day 0 | Triaged |
| Day 1 | Bounty paid |
| Day 14 | Fixed |

Variants to test
- Other document formats rendered in-app: upload formats that support scripting or active content and check whether the preview executes anything. A positive result is script running in the viewer's origin.
- Different viewer entry points: previews in admin panels, support consoles or moderation queues may use a different renderer from the candidate-facing one. A positive result is execution in a context with more privileges than the uploader has.
- Renderer configuration: check whether the same document is neutralised in one viewer and active in another. A positive result is inconsistent handling, which points at the unsandboxed path.
- Upload validation bypass: try documents that pass the upload check but still carry active content. A positive result is a stored file that executes when opened.
The takeaway is that for any application rendering user content, the renderer deserves the same scrutiny as the upload check.
What happened, in plain words
A security researcher found a way to put JavaScript, the programming language that runs in web pages, inside a PDF file and upload it as a job application resume. When someone on the recruiting side opened the PDF to preview it, the JavaScript ran inside the company's website, in that recruiter's logged-in session. This kind of attack is called stored cross-site scripting (stored XSS): the malicious code is stored on the server (here, inside the uploaded PDF) and later runs in the browser of anyone who views it. The researcher reported it, the company paid a bounty (a reward for finding security bugs), and fixed it by sandboxing the PDF viewer and turning off JavaScript in uploaded documents.
Context
The target was a job application portal: a website where people apply for jobs by filling in a form and uploading their CV (resume). The normal flow is simple: a candidate uploads a PDF, and later a recruiter opens it to read it. The researcher's key point is that PDFs are widely treated as a safe file type, but a PDF can contain JavaScript that runs automatically when a viewer opens it, through a feature called OpenAction. OpenAction is a PDF instruction that tells the viewer to do something as soon as the document is opened, and that something can be running JavaScript.
Setup
The write-up does not describe any accounts, roles, tools or software versions. What matters is the precondition: the application stores an uploaded PDF and then displays it back inside a viewer used by recruiters. The researcher needed nothing more than the ability to submit an application with an attached resume. No special access, no insider account, just the public upload form.
Finding it
While looking around the portal, the researcher noticed that resumes could be uploaded as PDFs and that the recruiting side previews them. The reasoning was that checking the upload is not the whole story. If the application displays user-supplied documents in its own viewer, then the viewer's handling of embedded JavaScript decides whether the file is safe. PDFs can run JavaScript via OpenActions, which the researcher notes most people forget. In everyday terms: a PDF is not just a picture of a page; it is a small program that a viewer interprets, and some of its instructions can execute code.
Exploitation
Step 1: Build a PDF with an embedded JavaScript payload
The researcher created a PDF containing an embedded JavaScript alert payload. An alert is the simplest JavaScript action: it makes a pop-up box appear. The write-up does not include the file or its source, so the exact OpenAction structure is not shown. The goal of this step was to produce a PDF that carries code which runs when opened.
Step 2: Upload it as a resume
The PDF was submitted as the resume on a job application through the portal's normal upload flow. No request or response is reproduced in the write-up. The goal was to get the file stored on the company's server, so that it would later be opened by someone on the recruiting side.
Step 3: Wait for the recruiter-side preview
The researcher then waited for the recruiting side to preview the document. When the PDF rendered in the application's viewer, the JavaScript fired. The result was stored XSS: the payload persisted in the uploaded document and executed when the document was opened, with no user interaction needed beyond opening it. In other words, the recruiter did not have to click a suspicious link or approve anything; simply opening the resume was enough.

Root cause
The application accepted a PDF containing JavaScript and then rendered that PDF in a viewer that executed it. The upload check, whatever it validated, did not prevent an active document from being stored, and the rendering path did not isolate the document from the application's session. In other words, the renderer was trusted with content the user controls. The write-up does not describe the viewer or its configuration, so the precise reason JavaScript was allowed to run is not stated; The write-up does not describe the viewer or its configuration, so the precise reason JavaScript was allowed to run is not stated. A sandbox is a restricted environment: it lets a program run but blocks it from touching anything outside its box, like a playpen for code.
Impact
The payload ran in the session of whoever opened the resume, in this case a recruiter. A session is the logged-in state of a user: after you log in, the site gives your browser a cookie (a small piece of data) that proves who you are on each request. If an attacker can run code in that session, they can act as the recruiter. The researcher lists the consequences as session theft, account takeover, or silently scraping candidate data. Session theft means stealing the cookie that proves the login; account takeover means using that stolen session to control the account; scraping candidate data means quietly reading and copying the personal information of applicants. The condition is that a recruiter opens the document; beyond that, no interaction is required. The write-up does not quantify how many users or documents were affected.
Fix
The vendor sandboxed their PDF renderer and disabled JavaScript execution in uploaded documents. Both changes address the rendering path rather than the upload itself. In plain terms, they put the PDF viewer in a playpen and told it not to run any JavaScript from uploaded files, so even a malicious PDF can no longer execute code in the recruiter's session.
Timeline
| Day | Event |
|---|---|
| Day 0 | Reported |
| Day 0 | Triaged |
| Day 1 | Bounty paid |
| Day 14 | Fixed |

Variants to test
- Other document formats rendered in-app: upload formats that support scripting or active content and check whether the preview executes anything. A positive result is script running in the viewer's origin. Origin is the combination of scheme, host and port that a browser uses to decide which site a page belongs to; script running in the viewer's origin means it runs with the site's permissions.
- Different viewer entry points: previews in admin panels, support consoles or moderation queues may use a different renderer from the candidate-facing one. A positive result is execution in a context with more privileges than the uploader has. Privileges are the permissions an account has; a recruiter or admin usually has more than a candidate.
- Renderer configuration: check whether the same document is neutralised in one viewer and active in another. A positive result is inconsistent handling, which points at the unsandboxed path.
- Upload validation bypass: try documents that pass the upload check but still carry active content. A positive result is a stored file that executes when opened. Validation is the check the site performs on an upload, for example looking at the file extension or type.
The takeaway is that for any application rendering user content, the renderer deserves the same scrutiny as the upload check.
Glossary
- API: a way for one program to talk to another, like a waiter taking your order to the kitchen.
- Bounty: a reward paid by a company to someone who reports a security bug responsibly.
- Cookie: a small piece of data a website stores in your browser, often used to remember that you are logged in.
- Cross-site scripting (XSS): a vulnerability where an attacker gets their code to run in another user's browser on a website.
- Stored XSS: XSS where the malicious code is saved on the server (for example in an uploaded file) and runs when someone later views it.
- JavaScript: the programming language that web pages use to make things happen in the browser.
- OpenAction: a PDF instruction that tells the viewer to do something automatically when the document is opened, which can include running JavaScript.
- PDF: a file format for documents that can include text, images and instructions for the viewer.
- Payload: the part of an attack that does the damage, here the JavaScript that runs.
- Renderer / viewer: the software that reads a file and displays it on screen.
- Sandbox: a restricted environment that lets a program run but blocks it from affecting anything outside.
- Session: the logged-in state of a user on a website, usually maintained with a cookie.
- Session theft: stealing a user's session cookie so you can act as them.
- Account takeover: gaining control of someone else's account, often by stealing their session.
- Scraping: automatically reading and copying data from a website.
- Origin: the scheme, host and port of a page, used by browsers to separate sites from each other.
- Privileges: the permissions an account has, such as what it is allowed to view or change.
- Validation: a check a website performs on input, such as an uploaded file, to decide whether to accept it.
- Triaged: the stage where a security team reviews a report and confirms it is a real issue.
- Vendor: the company that makes or runs the software.
- Alert: a simple JavaScript pop-up used to prove that code can run.