Arbitrary JavaScript execution due to using outdated librariesGHSA-4m3g-6r7g-jv4f
LOWFix: freddyaboulton/gradio-pdf@67edd0cGHSA-4m3g-6r7g-jv4f is a low-severity (CVSS 3.6) vulnerability in gradio-pdf. A fix is available for gradio-pdf — see the affected versions and patch details below.
Real-World Exposure
gradio-pdfReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
gradio-pdf projects with dependencies on the pdf.js library are vulnerable to CVE-2024-4367, which allows arbitrary JavaScript execution.
PoC
-
Generate a pdf file with a malicious script in the fontmatrix. (This will run
alert(‘XSS’).) poc.pdf -
Run the app. In this PoC, I've used the demo for a simple proof.
-
Upload a PDF file containing the script.
-
Check that the script is running.
Impact
Malicious scripts can be injected into the code, and when linked with vulnerabilities such as CSRF, it can cause even greater damage. In particular, It can become a source of further attacks, especially when linked to social engineering.
Mitigation
Upgrade the pdf.js to v4.2.67, which removes the vulnerability. (or set the option isEvalSupported to false.)
Reference
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | gradio-pdf | all versions | 0.0.10pip install --upgrade 'gradio-pdf==0.0.10' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for gradio-pdf, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update gradio-pdf to 0.0.10 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-4m3g-6r7g-jv4f is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Frequently Asked Questions
Is GHSA-4m3g-6r7g-jv4f in your dependencies?
Find it across PyPI, including transitive dependencies.