Skip to content
XSS Write-up Intermediate

CVE-2025-47943: Stored XSS in Gogs via PDF

Gogs versions up to 0.13.2 bundled an outdated PDF.js component that rendered PDFs in a way that allowed stored JavaScript to execute. An attacker could upload a crafted PDF so that its script ran in a victim's browser when the file was viewed.

Edoardo Ottavianelli Follow

Published on hacktivesecurity.com

Application Security

Edoardo Ottavianelli, on hacktivesecurity.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

Root cause

Likely the bundled PDF.js version 1.4.20 was outdated and did not sanitise script content inside PDFs before rendering them.

Impact

An attacker could run JavaScript in a victim's browser session on the Gogs site, though the text does not describe what that script could then do.

What the attacker needed

Gogs 0.13.2 or earlier; attacker can upload a PDF; victim views the PDF

The fix

It was fixed in Gogs version 0.13.3.

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 stored cross-site scripting bug means a malicious file saved on the site can run code in the browser of anyone who opens it. Here the site used an old PDF viewer that did not block scripts hidden inside a PDF, so opening the file could run that script as if it came from the site.

What is XSS?

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

More by Edoardo Ottavianelli

View all

2 more disclosed reports, best first.

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.