Server-Side XSS via PDF Generation Functionality
A hidden parameter in a booking form was passed to a server-side PDF renderer, causing the server to execute injected JavaScript. The attacker could freeze the rendering process, open unexpected ports, and access the internal file system, including a .env file with database credentials.
medium.com
Published on medium.com
It was just another routine security assessment. I was looking at a hotel reservation website, navigating through standard pages, and mapping the attack surface.
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
Root cause
Likely the server-side PDF renderer executed untrusted JavaScript from user input without sandboxing or proper permissions.
Impact
The attacker could cause a denial of service by freezing the server process, and could read internal files including a .env file with database credentials, leading to full backend access.
What the attacker needed
Access to the booking form; ability to intercept and modify requests
The fix
The PDF rendering process should be sandboxed and run with minimal permissions, and user input should be sanitised before rendering.
How it was found
- Fill out the booking form and intercept the request.
- Inject a script payload into the hidden datapara parameter.
- Send the request and observe the server hang.
- Scan for open ports and find a new high-numbered port.
- Send another request and scan again to see another port open.
- Access the open port in a browser to view the internal file system and find the .env file.
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.
When a website creates a PDF from your input, it may use a hidden browser on the server to do so. If that browser runs any JavaScript you provide, an attacker can make it do things like open pop-ups that freeze the process. This report shows how that freeze led to exposed files and secrets.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.