{"answers":{"affected":"2 open source packages ship an affected version, including gradio-pdf and gradio_pdf.","exploited":"There is no known exploitation of GHSA-4m3g-6r7g-jv4f in the wild and no public exploit code.","fix":"Upgrade gradio-pdf to 0.0.10 or later.","what":"GHSA-4m3g-6r7g-jv4f is a cross-site scripting vulnerability in gradio-pdf, published on 5 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-4m3g-6r7g-jv4f and fix it if it is affected.\n\nWhat it is: GHSA-4m3g-6r7g-jv4f is a cross-site scripting vulnerability in gradio-pdf, published on 5 Jun 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-4m3g-6r7g-jv4f in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- gradio-pdf (PyPI): affected all versions; fixed in 0.0.10\n- gradio_pdf (PyPI): affected all versions; fixed in 0.0.10\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-4m3g-6r7g-jv4f/ (Markdown: https://insights.sbomify.com/GHSA-4m3g-6r7g-jv4f/index.md)","id":"GHSA-4m3g-6r7g-jv4f","markdown":"https://insights.sbomify.com/GHSA-4m3g-6r7g-jv4f/index.md","name":"GHSA-4m3g-6r7g-jv4f","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":false,"product_category":"Python PDF library","requires_auth":"none","summary":"Attackers can execute arbitrary JavaScript by uploading malicious PDFs to applications using the vulnerable gradio-pdf library.","user_interaction":"required","vuln_class":"xss"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### Summary\ngradio-pdf projects with dependencies on the pdf.js library are vulnerable to CVE-2024-4367, which allows arbitrary JavaScript execution.\n\n### PoC\n1. Generate a pdf file with a malicious script in the fontmatrix. (This will run `alert(‘XSS’)`.)\n[poc.pdf](https://github.com/user-attachments/files/15516798/poc.pdf)\n\n2. Run the app. In this PoC, I've used the demo for a simple proof.\n![1](https://github.com/freddyaboulton/gradio-pdf/assets/114328108/d1bb7626-3d0f-4984-8873-297658d6e77e)\n\n3. Upload a PDF file containing the script.\n![2](https://github.com/freddyaboulton/gradio-pdf/assets/114328108/803d8080-c946-446e-bb34-cf5640e1b4de)\n\n4. Check that the script is running.\n![3](https://github.com/freddyaboulton/gradio-pdf/assets/114328108/4956b95f-acca-4bb1-a3c2-7dfc96adf890)\n\n### Impact\nMalicious 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.\n\n### Mitigation\nUpgrade the pdf.js to v4.2.67, which removes the vulnerability. (or set the option `isEvalSupported` to `false`.)\n\n### Reference\n1. https://codeanlabs.com/blog/research/cve-2024-4367-arbitrary-js-execution-in-pdf-js/\n2. https://github.com/mozilla/pdf.js/pull/18015","ecosystems":["PyPI"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Arbitrary JavaScript execution due to using outdated libraries","id":"GHSA-4m3g-6r7g-jv4f","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"PyPI","product":null,"products":[],"type":"xss","year":"2024"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"PyPI","fixed":["0.0.10"],"introduced":["0"],"last_affected":[],"package":"gradio-pdf","purl":"pkg:pypi/gradio-pdf","source":"GHSA-4m3g-6r7g-jv4f"},{"ecosystem":"PyPI","fixed":["0.0.10"],"introduced":["0"],"last_affected":[],"package":"gradio_pdf","purl":null,"source":"GHSA-4m3g-6r7g-jv4f"}],"products":null,"published":"2024-06-05","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Attackers can execute arbitrary JavaScript by uploading malicious PDFs to applications using the vulnerable gradio-pdf library.","url":"https://insights.sbomify.com/GHSA-4m3g-6r7g-jv4f/"}