GHSA-hq66-cqwq-w95j: XSS
Impact
If PDF.js is used to load a malicious PDF, and PDF.js is configured with enableScripting set to true (which is the default value) and no CSP for disallowing script-src, unrestricted attacker-controlled JavaScript will be executed in the context of the hosting domain.
Patches
Workarounds Set enableScripting to false or set a CSP.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/pdfjs-distto a version that resolves this vulnerability.Fixed in 6.2.108 - Configuration
Set PDF.js enableScripting to false (it defaults to true) to prevent attacker-controlled JavaScript execution when loading a malicious PDF.
PDF.js enableScripting = false - Configuration
Configure a Content Security Policy (CSP) that disallows script-src so injected attacker-controlled JavaScript cannot execute in the hosting domain.
PDF.js / Hosting site CSP Content-Security-Policy (script-src) = disallow script-src for injected scripts