Hunting Bugs at IIT Madras: From PDF.js XSS to WordPress DoS
A site used the PDF.js viewer and accepted an external URL through its file parameter without restriction, so a crafted malicious PDF could run JavaScript in the target's origin. Separately, a WordPress site exposed wp-cron.php publicly without rate limiting, so repeated requests could make it unavailable.
medium.com
Published on medium.com
So the story is I was looking at IITM website hoping to find something cool to add to my collection. I scanned every subdomain, every login portal and found.. maybe you guessed .. nothing.
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 PDF.js viewer was not isolated on its own domain and did not validate or block external file URLs, and the WordPress cron endpoint was left publicly reachable without rate limiting.
Impact
The XSS could allow cookie theft, session hijacking and in some cases full account takeover, while the cron flooding could cause downtime and resource exhaustion.
What the attacker needed
A page using the PDF.js viewer; ability to host a malicious PDF; publicly reachable wp-cron endpoint
The fix
The PDF.js viewer should be sandboxed on a separate domain with a strict CSP and external file loading validated or disabled, and wp-cron should be disabled for public access with rate limiting on sensitive endpoints.
How it was found
- Find a page that renders documents with the PDF.js viewer.
- Supply an external URL through the file parameter.
- Host a crafted malicious PDF and point the viewer at it.
- Observe JavaScript execution in the target's origin.
- Repeatedly request the public wp-cron endpoint to exhaust resources.
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.
PDF.js is a script that displays PDF files in the browser. Here the site let anyone point it at a PDF hosted elsewhere, and a specially made PDF could run code as if it came from the site itself, which is called cross-site scripting. The second issue is simpler: a maintenance page meant for the server was reachable by anyone, and flooding it could take the site down.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.