{"vuln_id":"GHSA-555j-qj3j-c8jv","aliases":["CVE-2026-132275","CVE-2019-20446"],"description":"svglib: Exponential resource consumption via nested <use> references in svg2rlg","published_at":"2026-11-20T23:47:58Z","modified_at":"2026-11-21T00:00:04.016340Z","first_seen_at":"2026-11-21T19:15:19.251067Z","severity":"high","severity_source":"ghsa","cvss_score":7.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","cwe":["CWE-400","CWE-776"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-555j-qj3j-c8jv"},"matched_alias":null,"items":[{"id":10649,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-555j-qj3j-c8jv: svglib: Exponential resource consumption via nested <use> references in svg2rlg","summary":"svglib: Exponential resource consumption via nested\nreferences in svg2rlg\n\n# Summary\n\n`svg2rlg()` expands `\n` references without any limit on the total number of expansions. Only direct cycles are rejected (`CircularRefError`). A group containing N `\n` elements that point to another such group multiplies the work by N per nesting level, so an SVG of about 1.4 KB makes svglib clone and render over 100,000 nodes, taking tens of seconds of CPU time and hundreds of MiB of memory. Each additional level adds about 245 bytes to the document and multiplies time by ~10.\n\nThis is the SVG `\n` variant of the XML \"billion laughs\" attack (the same class as librsvg CVE-2019-20446).\n\n# Details\n\n`SvgRenderer.renderUse()` in `src/svglib/svglib.py`:\n\n```python\ntry:\nitem = self.xlink_href_target(node, group=group)\nexcept CircularRefError:\nnode.parent.etree_element.remove(node.etree_element)\nreturn group\n...\nif len(node.getchildren()) == 0:\n# Append a copy of the referenced node as the\nchild (if not\n# already done)\nnode.append(copy.deepcopy(item))\nself.renderNode(list(node.iter_children())[-1], parent=group)\n```\n\nThe referenced node is deep-copied under the `\n` element and rendered. Any `\n` elements inside the copied subtree go through `renderUse()` again. `xlink_href_target()` raises `CircularRefError` only for a direct cycle, so a reference DAG with fan-out is expanded fully: `fan ** levels` renders.\n\nPayload shape (fan = 10, levels = 5):\n\n```xml\n\n... 10 times ...\n\n... 10 times ...\n\n...\n\n... 10 times ...\n\n```\n\n# Impact\n\nDenial of service (CPU and memory exhaustion) for any application that renders SVG from an untrusted source with svglib: thumbnail/preview generation, SVG-to-PDF conversion, report generation. Only the SVG document needs to be attacker-controlled; no non-default option is required.\n\nThe same happens through `xhtml2pdf`, which depends on svglib to render SVG images. An HTML document containing `\n` passed to `pisa.CreatePDF()` triggers the expansion. HTML-to-PDF conversion of user-supplied content is a common use of xhtml2pdf in web applications.\n\n# Reproduction\n\nMinimal local PoC, non-destructive:\n\n```python\nimport io, time\nfrom svglib.svglib import svg2rlg\n\ndef make(levels, fan=10):\nparts = ['\n',\n'\n']\nfor i in range(1, levels + 1):\nparts.append(f'\n' + f'\n' * fan + '\n')\nparts.append(f'\n')\nreturn \"\".join(parts).encode()\n\nfor levels in (3, 4, 5):\nd\n\nAffected: PyPI:svglib\n\nFixed in: 2.3.1\n\nReferences:\nhttps://github.com/deeplook/svglib/security/advisories/GHSA-555j-qj3j-c8jv\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-132275\nhttps://github.com/deeplook/svglib/commit/7380d3c3836940fd75f8e203fff80077b7d5a425\nhttps://github.com/deeplook/svglib\nhttps://github.com/deeplook/svglib/releases/tag/v2.3.1","url":"https://osv.dev/vulnerability/GHSA-555j-qj3j-c8jv","published_at":"2026-11-20T23:47:58Z","updated_at":"2026-11-21T00:00:04.016340Z","fetched_at":"2026-11-21T19:15:55.946075Z","severity":"high","cvss_score":7.5,"epss":0.02125,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"svglib","vuln_id":"CVE-2026-132275","vuln_ids":["CVE-2019-20446","CVE-2026-132275","GHSA-555J-QJ3J-C8JV"],"tags":["osv","pypi","fix-available"],"cluster_id":1983,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10649","html":"https://vulnwatch.ve1ve2.com/item/10649"}},{"id":2283,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-555j-qj3j-c8jv / CVE-2026-132275: svglib: Exponential resource consumption via nested <use> references in svg2rlg","summary":"svglib: Exponential resource consumption via nested\nreferences in svg2rlg\n\n# Summary\n\n`svg2rlg()` expands `\n` references without any limit on the total number of expansions. Only direct cycles are rejected (`CircularRefError`). A group containing N `\n` elements that point to another such group multiplies the work by N per nesting level, so an SVG of about 1.4 KB makes svglib clone and render over 100,000 nodes, taking tens of seconds of CPU time and hundreds of MiB of memory. Each additional level adds about 245 bytes to the document and multiplies time by ~10.\n\nThis is the SVG `\n` variant of the XML \"billion laughs\" attack (the same class as librsvg CVE-2019-20446).\n\n# Details\n\n`SvgRenderer.renderUse()` in `src/svglib/svglib.py`:\n\n```python\ntry:\nitem = self.xlink_href_target(node, group=group)\nexcept CircularRefError:\nnode.parent.etree_element.remove(node.etree_element)\nreturn group\n...\nif len(node.getchildren()) == 0:\n# Append a copy of the referenced node as the\nchild (if not\n# already done)\nnode.append(copy.deepcopy(item))\nself.renderNode(list(node.iter_children())[-1], parent=group)\n```\n\nThe referenced node is deep-copied under the `\n` element and rendered. Any `\n` elements inside the copied subtree go through `renderUse()` again. `xlink_href_target()` raises `CircularRefError` only for a direct cycle, so a reference DAG with fan-out is expanded fully: `fan ** levels` renders.\n\nPayload shape (fan = 10, levels = 5):\n\n```xml\n\n... 10 times ...\n\n... 10 times ...\n\n...\n\n... 10 times ...\n\n```\n\n# Impact\n\nDenial of service (CPU and memory exhaustion) for any application that renders SVG from an untrusted source with svglib: thumbnail/preview generation, SVG-to-PDF conversion, report generation. Only the SVG document needs to be attacker-controlled; no non-default option is required.\n\nThe same happens through `xhtml2pdf`, which depends on svglib to render SVG images. An HTML document containing `\n` passed to `pisa.CreatePDF()` triggers the expansion. HTML-to-PDF conversion of user-supplied content is a common use of xhtml2pdf in web applications.\n\n# Reproduction\n\nMinimal local PoC, non-destructive:\n\n```python\nimport io, time\nfrom svglib.svglib import svg2rlg\n\ndef make(levels, fan=10):\nparts = ['\n',\n'\n']\nfor i in range(1, levels + 1):\nparts.append(f'\n' + f'\n' * fan + '\n')\nparts.append(f'\n')\nreturn \"\".join(parts).encode()\n\nfor levels in (3, 4, 5):\nd\n\nAffected packages: pip:svglib\nPatched: svglib 2.3.1","url":"https://github.com/advisories/GHSA-555j-qj3j-c8jv","published_at":"2026-11-20T23:47:58Z","updated_at":"2026-11-20T23:47:59Z","fetched_at":"2026-11-21T19:15:18.416719Z","severity":"high","cvss_score":7.5,"epss":0.02125,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"svglib","vuln_id":"CVE-2026-132275","vuln_ids":["CVE-2019-20446","CVE-2026-132275","GHSA-555J-QJ3J-C8JV"],"tags":["ghsa","pip","CWE-400","CWE-776"],"cluster_id":1983,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2283","html":"https://vulnwatch.ve1ve2.com/item/2283"}},{"id":9918,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-132275: svglib reads SVG files and converts them to other formats. Prior to 2.3.1, the svg2rlg() renderer recursively expands nested SVG <use> references by deep-copyi…","summary":"svglib reads SVG files and converts them to other formats. Prior to 2.3.1, the svg2rlg() renderer recursively expands nested SVG\nreferences by deep-copying each referenced subtree; SvgRenderer.renderUse() in src/svglib/svglib.py calls xlink_href_target(), which rejects direct cycles but permits acyclic reference graphs with repeated fan-out. A small attacker-controlled SVG can therefore trigger exponentially increasing node expansion, consuming excessive CPU and memory in any application that renders it without a non-default option; HTML-to-PDF workflows using xhtml2pdf can reach the same renderer when an embedded data:image/svg+xml image in an HTML img element is passed to pisa.CreatePDF(). This issue is fixed in 2.3.1.\n\nReferences:\nhttps://github.com/deeplook/svglib/commit/7380d3c3836940fd75f8e203fff80077b7d5a425\nhttps://github.com/deeplook/svglib/releases/tag/v2.3.1\nhttps://github.com/deeplook/svglib/security/advisories/GHSA-555j-qj3j-c8jv\nhttps://github.com/deeplook/svglib/security/advisories/GHSA-555j-qj3j-c8jv","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-132275","published_at":"2026-11-20T17:18:12.567000Z","updated_at":"2026-11-20T19:18:46.433000Z","fetched_at":"2026-11-21T19:15:31.485417Z","severity":"high","cvss_score":7.5,"epss":0.0106,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-132275","vuln_ids":["CVE-2019-20446","CVE-2026-132275","GHSA-555J-QJ3J-C8JV"],"tags":["CWE-400","CWE-776"],"cluster_id":1984,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/9918","html":"https://vulnwatch.ve1ve2.com/item/9918"}}]}